@xuda.io/ai_module 1.1.5512 → 1.1.5514

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.mjs +9 -12
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -5120,34 +5120,31 @@ const add_conversation_item = async function (uid, profile_id, conversation_id,
5120
5120
  if (account_info_ret.code < 0) throw new Error(account_info_ret.data);
5121
5121
  const account_info = account_info_ret.data;
5122
5122
 
5123
- let contact_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, contact_id);
5124
5123
  const conversation_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, conversation_id);
5125
5124
 
5126
5125
  let text = `${new Date()} User Uid: ${uid} User Name: ${account_info.full_name} Type: ${conversation_type}`;
5127
5126
 
5128
- try {
5129
- const item = await client.conversations.items.create(conversation_doc.reference_conversation_id, {
5130
- items: [
5127
+ const items= [
5131
5128
  {
5132
5129
  type: 'message',
5133
5130
  role: 'user',
5134
5131
  content: [{ type: 'input_text', text }],
5135
5132
  },
5136
5133
  ],
5134
+
5135
+
5136
+ try {
5137
+ const item = await client.conversations.items.create(conversation_doc.reference_conversation_id, {
5138
+ items
5137
5139
  });
5138
5140
  } catch (err) {
5139
5141
  throw err;
5140
5142
  }
5141
5143
  if (contact_id) {
5142
5144
  try {
5143
- const item = await client.conversations.items.create(conversation_doc.reference_conversation_id, {
5144
- items: [
5145
- {
5146
- type: 'message',
5147
- role: 'user',
5148
- content: [{ type: 'input_text', text }],
5149
- },
5150
- ],
5145
+ let contact_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, contact_id);
5146
+ const item = await client.conversations.items.create(contact_doc.contact_reference_conversation_id, {
5147
+ items
5151
5148
  });
5152
5149
  } catch (err) {
5153
5150
  throw err;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.5512",
3
+ "version": "1.1.5514",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",