@xuda.io/ai_module 1.1.4557 → 1.1.4558
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 +4 -2
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -4402,7 +4402,7 @@ const chat_note = async function (req, job_id, headers) {
|
|
|
4402
4402
|
sender_conversation_doc.messages.push(obj);
|
|
4403
4403
|
await db_module.save_app_couch_doc_native(sender_app_id, sender_conversation_doc);
|
|
4404
4404
|
|
|
4405
|
-
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 });
|
|
4405
|
+
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 });
|
|
4406
4406
|
|
|
4407
4407
|
return { code: 15, data: item };
|
|
4408
4408
|
} catch (err) {
|
|
@@ -4514,6 +4514,7 @@ const chat_email = async function (req, job_id, headers) {
|
|
|
4514
4514
|
email_id,
|
|
4515
4515
|
subject,
|
|
4516
4516
|
last_email_item_id: last_email_item?._id,
|
|
4517
|
+
reference_id: conversation_doc.reference_id,
|
|
4517
4518
|
});
|
|
4518
4519
|
|
|
4519
4520
|
return save_ret;
|
|
@@ -5153,6 +5154,7 @@ const ai_chat_conversation = async function (req, job_id, headers) {
|
|
|
5153
5154
|
output: output.output,
|
|
5154
5155
|
prompt,
|
|
5155
5156
|
response: output.state._currentStep.output,
|
|
5157
|
+
reference_id: conversation_doc.reference_id,
|
|
5156
5158
|
});
|
|
5157
5159
|
|
|
5158
5160
|
account_module.record_ai_usage(uid, inputTokens, outputTokens, 'conversation chat', prompt, model, { conversation_id, ai_agent_id: obj.ai_agent_id, item_id: obj.id }, account_profile_info);
|
|
@@ -6407,7 +6409,7 @@ const attachment_handler = async function (uid, app_id, conversation_id, attachm
|
|
|
6407
6409
|
const obj = { id: items.last_id, ts: Date.now(), conversation_type: 'attachment', file };
|
|
6408
6410
|
system_message_items.push(obj);
|
|
6409
6411
|
|
|
6410
|
-
await db_module.save_app_couch_doc_native(account_profile_info.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, file, transcript });
|
|
6412
|
+
await db_module.save_app_couch_doc_native(account_profile_info.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, file, transcript, reference_id: conversation_doc.reference_id });
|
|
6411
6413
|
}
|
|
6412
6414
|
|
|
6413
6415
|
// const items = await client.conversations.items.create(conversation_id, {
|