@xuda.io/ai_module 1.1.5527 → 1.1.5529

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 +7 -6
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -3855,8 +3855,9 @@ const contact_chat_conversation = async function (req, job_id, headers) {
3855
3855
  const sender_app_id = account_profile_info.app_id;
3856
3856
  let sender_conversation_doc = await db_module.get_app_couch_doc_native(sender_app_id, conversation_id);
3857
3857
 
3858
+ let conversation_item_reference_id;
3858
3859
  try {
3859
- add_conversation_item(uid, profile_id, conversation_id, prompt, 'chat', conversation_doc.reference_id, { direction: 'out' });
3860
+ conversation_item_reference_id = await add_conversation_item(uid, profile_id, conversation_id, prompt, 'chat', conversation_doc.reference_id, { direction: 'out' });
3860
3861
 
3861
3862
  report_ai_status('conversations');
3862
3863
  } catch (err) {
@@ -3880,7 +3881,7 @@ const contact_chat_conversation = async function (req, job_id, headers) {
3880
3881
  conversation_id,
3881
3882
  text: body,
3882
3883
  reference_id: conversation_doc.reference_id,
3883
- conversation_item_reference_id: item.data[0].id,
3884
+ conversation_item_reference_id,
3884
3885
  direction: 'out',
3885
3886
  role: 'user',
3886
3887
  };
@@ -4031,9 +4032,6 @@ const chat_email = async function (req, job_id, headers) {
4031
4032
  throw err;
4032
4033
  }
4033
4034
 
4034
- // let obj = { id: item.data[0].id, ts: Date.now(), uid, read: true, conversation_type: 'email' };
4035
-
4036
- // sender_conversation_doc.messages.push(obj);
4037
4035
  await db_module.save_app_couch_doc_native(sender_app_id, sender_conversation_doc);
4038
4036
 
4039
4037
  let out_conversation_item_obj = {
@@ -5122,8 +5120,9 @@ const add_conversation_item = async function (uid, profile_id, conversation_id,
5122
5120
  },
5123
5121
  ];
5124
5122
 
5123
+ let item;
5125
5124
  try {
5126
- const item = await client.conversations.items.create(conversation_doc.reference_conversation_id, {
5125
+ item = await client.conversations.items.create(conversation_doc.reference_conversation_id, {
5127
5126
  items,
5128
5127
  });
5129
5128
  } catch (err) {
@@ -5139,6 +5138,8 @@ const add_conversation_item = async function (uid, profile_id, conversation_id,
5139
5138
  throw err;
5140
5139
  }
5141
5140
  }
5141
+
5142
+ return item.data[0].id;
5142
5143
  } catch (err) {
5143
5144
  throw err;
5144
5145
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.5527",
3
+ "version": "1.1.5529",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",