@xuda.io/ai_module 1.1.4603 → 1.1.4605
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.
- package/index.mjs +24 -5
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -4388,7 +4388,7 @@ const chat_note = async function (req, job_id, headers) {
|
|
|
4388
4388
|
|
|
4389
4389
|
await attachment_handler(uid, sender_app_id, conversation_id, attachments, account_profile_info);
|
|
4390
4390
|
|
|
4391
|
-
const item = await client.conversations.items.create(
|
|
4391
|
+
const item = await client.conversations.items.create(conversation_doc.reference_conversation_id, {
|
|
4392
4392
|
items: [
|
|
4393
4393
|
{
|
|
4394
4394
|
type: 'message',
|
|
@@ -4398,12 +4398,31 @@ const chat_note = async function (req, job_id, headers) {
|
|
|
4398
4398
|
],
|
|
4399
4399
|
});
|
|
4400
4400
|
|
|
4401
|
-
let obj = { id: item.data[0].id, ts: Date.now(), uid, read: true, conversation_type: 'note' };
|
|
4401
|
+
// let obj = { id: item.data[0].id, ts: Date.now(), uid, read: true, conversation_type: 'note' };
|
|
4402
4402
|
|
|
4403
|
-
sender_conversation_doc.messages.push(obj);
|
|
4404
|
-
await db_module.save_app_couch_doc_native(sender_app_id, sender_conversation_doc);
|
|
4403
|
+
// sender_conversation_doc.messages.push(obj);
|
|
4404
|
+
// await db_module.save_app_couch_doc_native(sender_app_id, sender_conversation_doc);
|
|
4405
|
+
|
|
4406
|
+
let out_conversation_item_obj = {
|
|
4407
|
+
_id: await _common.xuda_get_uuid('chat_conversation_item'),
|
|
4408
|
+
stat: 3,
|
|
4409
|
+
docType: 'chat_conversation_item',
|
|
4410
|
+
uid,
|
|
4411
|
+
conversation_type: 'note',
|
|
4412
|
+
type: 'note',
|
|
4413
|
+
date_created_ts: Date.now(),
|
|
4414
|
+
ts: Date.now(),
|
|
4415
|
+
conversation_id,
|
|
4416
|
+
text: body,
|
|
4417
|
+
reference_id: conversation_doc.reference_id,
|
|
4418
|
+
conversation_item_reference_id: item.data[0].id,
|
|
4419
|
+
direction: 'out',
|
|
4420
|
+
role: 'user',
|
|
4421
|
+
};
|
|
4422
|
+
|
|
4423
|
+
const save_ret = await db_module.save_app_couch_doc(sender_app_id, out_conversation_item_obj);
|
|
4405
4424
|
|
|
4406
|
-
await db_module.save_app_couch_doc_native(sender_app_id, { _id: obj.id, stat: 3, docType: 'chat_conversation_item', ts: obj.ts, uid, conversation_type: obj.conversation_type, date_created_ts: obj.ts, conversation_id, body, reference_id: conversation_doc.reference_id });
|
|
4425
|
+
// await db_module.save_app_couch_doc_native(sender_app_id, { _id: obj.id, stat: 3, docType: 'chat_conversation_item', ts: obj.ts, uid, conversation_type: obj.conversation_type, date_created_ts: obj.ts, conversation_id, body, reference_id: conversation_doc.reference_id });
|
|
4407
4426
|
|
|
4408
4427
|
return { code: 15, data: item };
|
|
4409
4428
|
} catch (err) {
|