@xuda.io/ai_module 1.1.5528 → 1.1.5530

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 -14
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -3855,9 +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
+ let conversation_item_reference_id;
3859
3859
  try {
3860
- const conversation_item_reference_id=await 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' });
3861
3861
 
3862
3862
  report_ai_status('conversations');
3863
3863
  } catch (err) {
@@ -3904,9 +3904,9 @@ const chat_note = async function (req, job_id, headers) {
3904
3904
  let sender_conversation_doc = await db_module.get_app_couch_doc_native(sender_app_id, conversation_id);
3905
3905
 
3906
3906
  await attachment_handler(uid, sender_app_id, conversation_id, attachments, account_profile_info);
3907
- let item;
3907
+ let conversation_item_reference_id;
3908
3908
  try {
3909
- add_conversation_item(uid, profile_id, conversation_id, body, 'note', conversation_doc.reference_id, {});
3909
+ conversation_item_reference_id = await add_conversation_item(uid, profile_id, conversation_id, body, 'note', conversation_doc.reference_id, {});
3910
3910
 
3911
3911
  report_ai_status('conversations');
3912
3912
  } catch (err) {
@@ -3914,11 +3914,6 @@ const chat_note = async function (req, job_id, headers) {
3914
3914
  throw err;
3915
3915
  }
3916
3916
 
3917
- // let obj = { id: item.data[0].id, ts: Date.now(), uid, read: true, conversation_type: 'note' };
3918
-
3919
- // sender_conversation_doc.messages.push(obj);
3920
- // await db_module.save_app_couch_doc_native(sender_app_id, sender_conversation_doc);
3921
-
3922
3917
  let out_conversation_item_obj = {
3923
3918
  _id: await _common.xuda_get_uuid('chat_conversation_item'),
3924
3919
  stat: 3,
@@ -3931,7 +3926,7 @@ const chat_note = async function (req, job_id, headers) {
3931
3926
  conversation_id,
3932
3927
  text: body,
3933
3928
  reference_id: conversation_doc.reference_id,
3934
- conversation_item_reference_id: item.data[0].id,
3929
+ conversation_item_reference_id,
3935
3930
  direction: 'out',
3936
3931
  role: 'user',
3937
3932
  read: { [uid]: Date.now() },
@@ -4032,7 +4027,6 @@ const chat_email = async function (req, job_id, headers) {
4032
4027
  throw err;
4033
4028
  }
4034
4029
 
4035
-
4036
4030
  await db_module.save_app_couch_doc_native(sender_app_id, sender_conversation_doc);
4037
4031
 
4038
4032
  let out_conversation_item_obj = {
@@ -5121,9 +5115,9 @@ const add_conversation_item = async function (uid, profile_id, conversation_id,
5121
5115
  },
5122
5116
  ];
5123
5117
 
5124
- let item
5118
+ let item;
5125
5119
  try {
5126
- item = await client.conversations.items.create(conversation_doc.reference_conversation_id, {
5120
+ item = await client.conversations.items.create(conversation_doc.reference_conversation_id, {
5127
5121
  items,
5128
5122
  });
5129
5123
  } catch (err) {
@@ -5140,7 +5134,7 @@ const add_conversation_item = async function (uid, profile_id, conversation_id,
5140
5134
  }
5141
5135
  }
5142
5136
 
5143
- return item.data[0].id
5137
+ return item.data[0].id;
5144
5138
  } catch (err) {
5145
5139
  throw err;
5146
5140
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.5528",
3
+ "version": "1.1.5530",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",