@xuda.io/ai_module 1.1.3805 → 1.1.3807
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 -9
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -4976,20 +4976,31 @@ const ai_chat_conversation = async function (req, job_id, headers) {
|
|
|
4976
4976
|
file_names.push(file.filename);
|
|
4977
4977
|
const transcript = await get_transcript(file.filename);
|
|
4978
4978
|
|
|
4979
|
-
system_message_items.push({
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
});
|
|
4979
|
+
// system_message_items.push({
|
|
4980
|
+
// type: 'message',
|
|
4981
|
+
// role: 'system',
|
|
4982
|
+
// content: [{ type: 'input_text', text: `the user attached file name: ${file.filename} with content: ${transcript.data || transcript}` }],
|
|
4983
|
+
// });
|
|
4984
4984
|
|
|
4985
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
|
+
});
|
|
4996
|
+
system_message_items.push({ id: items.last_id, ts: Date.now(), usage: { inputTokens: output.state._context.usage.inputTokens, outputTokens: output.state._context.usage.outputTokens }, file });
|
|
4986
4997
|
}
|
|
4987
4998
|
|
|
4988
|
-
const items = await client.conversations.items.create(conversation_id, {
|
|
4989
|
-
|
|
4990
|
-
});
|
|
4999
|
+
// const items = await client.conversations.items.create(conversation_id, {
|
|
5000
|
+
// items: system_message_items,
|
|
5001
|
+
// });
|
|
4991
5002
|
|
|
4992
|
-
console.log(items.data);
|
|
5003
|
+
// console.log(items.data);
|
|
4993
5004
|
|
|
4994
5005
|
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 };
|
|
4995
5006
|
conversation_doc = await db_module.get_app_couch_doc_native(app_id, conversation_id);
|