@xuda.io/ai_module 1.1.3804 → 1.1.3806
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 +20 -1
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -4982,13 +4982,32 @@ const ai_chat_conversation = async function (req, job_id, headers) {
|
|
|
4982
4982
|
content: [{ type: 'input_text', text: `the user attached file name: ${file.filename} with content: ${transcript.data || transcript}` }],
|
|
4983
4983
|
});
|
|
4984
4984
|
|
|
4985
|
-
prompt += await generate_XU_markdown('attachment', file); //`[]`;
|
|
4985
|
+
// prompt += await generate_XU_markdown('attachment', file); //`[]`;
|
|
4986
|
+
|
|
4987
|
+
const items = await client.conversations.items.create(conversation_id, {
|
|
4988
|
+
items: [
|
|
4989
|
+
{
|
|
4990
|
+
type: 'message',
|
|
4991
|
+
role: 'system',
|
|
4992
|
+
content: [{ type: 'input_text', text: `the user attached file name: ${file.filename} with content: ${transcript.data || transcript}` }],
|
|
4993
|
+
},
|
|
4994
|
+
],
|
|
4995
|
+
});
|
|
4986
4996
|
}
|
|
4987
4997
|
|
|
4988
4998
|
const items = await client.conversations.items.create(conversation_id, {
|
|
4989
4999
|
items: system_message_items,
|
|
4990
5000
|
});
|
|
5001
|
+
|
|
4991
5002
|
console.log(items.data);
|
|
5003
|
+
|
|
5004
|
+
const obj = { id: output?.output?.[0]?.id, ts: Date.now(), usage: { inputTokens: output.state._context.usage.inputTokens, outputTokens: output.state._context.usage.outputTokens }, ai_agent_id: output.state._currentAgent.name, attachments };
|
|
5005
|
+
conversation_doc = await db_module.get_app_couch_doc_native(app_id, conversation_id);
|
|
5006
|
+
|
|
5007
|
+
conversation_doc.ts = Date.now();
|
|
5008
|
+
conversation_doc.stat = 3;
|
|
5009
|
+
conversation_doc.messages.push(obj);
|
|
5010
|
+
await db_module.save_app_couch_doc_native(app_id, conversation_doc);
|
|
4992
5011
|
};
|
|
4993
5012
|
|
|
4994
5013
|
const set_ts_to_agent = async function () {
|