@xuda.io/ai_module 1.1.5527 → 1.1.5528

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 +8 -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
3858
3859
  try {
3859
- add_conversation_item(uid, profile_id, conversation_id, prompt, 'chat', conversation_doc.reference_id, { direction: 'out' });
3860
+ const 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,7 @@ 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);
4035
+
4037
4036
  await db_module.save_app_couch_doc_native(sender_app_id, sender_conversation_doc);
4038
4037
 
4039
4038
  let out_conversation_item_obj = {
@@ -5122,8 +5121,9 @@ const add_conversation_item = async function (uid, profile_id, conversation_id,
5122
5121
  },
5123
5122
  ];
5124
5123
 
5124
+ let item
5125
5125
  try {
5126
- const item = await client.conversations.items.create(conversation_doc.reference_conversation_id, {
5126
+ item = await client.conversations.items.create(conversation_doc.reference_conversation_id, {
5127
5127
  items,
5128
5128
  });
5129
5129
  } catch (err) {
@@ -5139,6 +5139,8 @@ const add_conversation_item = async function (uid, profile_id, conversation_id,
5139
5139
  throw err;
5140
5140
  }
5141
5141
  }
5142
+
5143
+ return item.data[0].id
5142
5144
  } catch (err) {
5143
5145
  throw err;
5144
5146
  }
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.5528",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",