@xuda.io/ai_module 1.1.3824 → 1.1.3825
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 +2 -2
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -5060,14 +5060,14 @@ const ai_chat_conversation = async function (req, job_id, headers) {
|
|
|
5060
5060
|
const output = await runner.run(_agent, prompt, opt);
|
|
5061
5061
|
const done = async function (output) {
|
|
5062
5062
|
try {
|
|
5063
|
-
const obj = { id: output?.output?.[0]?.id, ts: Date.now(),
|
|
5063
|
+
const obj = { id: output?.output?.[0]?.id, ts: Date.now(), ai_agent_id: output.state._currentAgent.name, attachments };
|
|
5064
5064
|
conversation_doc = await db_module.get_app_couch_doc_native(app_id, conversation_id);
|
|
5065
5065
|
|
|
5066
5066
|
conversation_doc.ts = Date.now();
|
|
5067
5067
|
conversation_doc.stat = 3;
|
|
5068
5068
|
conversation_doc.messages.push(obj);
|
|
5069
5069
|
await db_module.save_app_couch_doc_native(app_id, conversation_doc);
|
|
5070
|
-
|
|
5070
|
+
record_chat_usage(uid, output.state._context.usage.inputTokens, output.state._context.usage.outputTokens, 'submit chat', prompt);
|
|
5071
5071
|
// if (!conversation_doc.chat_image && (!conversation_doc.thumbnail_request_ts || Date.now() - conversation_doc.thumbnail_request_ts > 120000)) {
|
|
5072
5072
|
// update_thumbnail('conversation', conversation_doc, app_id, uid, job_id, headers);
|
|
5073
5073
|
// }
|