@xuda.io/ai_module 1.1.4564 → 1.1.4566
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 +21 -0
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -4529,6 +4529,27 @@ const ai_chat_conversation = async function (req, job_id, headers) {
|
|
|
4529
4529
|
let { prompt, conversation_doc, attachments = [], ai_agents, output_format = 'md', stream = true, with_context = true } = req;
|
|
4530
4530
|
await _utils.delay(1000);
|
|
4531
4531
|
const conversation_id = conversation_doc._id;
|
|
4532
|
+
|
|
4533
|
+
const obj = { id: output.state._lastTurnResponse.responseId, ts: Date.now(), ai_agent_id: output.state._currentAgent.name, attachments, conversation_type: 'ai_chat' };
|
|
4534
|
+
let conversation_item_obj = {
|
|
4535
|
+
_id: obj.id,
|
|
4536
|
+
stat: 1,
|
|
4537
|
+
docType: 'chat_conversation_item',
|
|
4538
|
+
uid,
|
|
4539
|
+
conversation_type: obj.conversation_type,
|
|
4540
|
+
type: obj.conversation_type,
|
|
4541
|
+
date_created_ts: Date.now(),
|
|
4542
|
+
ts: Date.now(),
|
|
4543
|
+
conversation_id,
|
|
4544
|
+
|
|
4545
|
+
text: prompt,
|
|
4546
|
+
|
|
4547
|
+
reference_id: conversation_doc.reference_id,
|
|
4548
|
+
direction: 'out',
|
|
4549
|
+
role: 'user',
|
|
4550
|
+
};
|
|
4551
|
+
await db_module.save_app_couch_doc_native(account_profile_info.app_id, conversation_item_obj);
|
|
4552
|
+
|
|
4532
4553
|
// const { account_profile_info } = conversation_doc;
|
|
4533
4554
|
const emitToDashboard = (type, content) => {
|
|
4534
4555
|
// console.log(type, content);
|