@xuda.io/ai_module 1.1.4010 → 1.1.4012
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 +3 -3
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -5146,15 +5146,15 @@ const ai_chat_conversation = async function (req, job_id, headers) {
|
|
|
5146
5146
|
try {
|
|
5147
5147
|
const obj = { id: output?.output?.[0]?.id, ts: Date.now(), ai_agent_id: output.state._currentAgent.name, attachments };
|
|
5148
5148
|
conversation_doc = await db_module.get_app_couch_doc_native(app_id, conversation_id);
|
|
5149
|
-
|
|
5149
|
+
|
|
5150
5150
|
conversation_doc.ts = Date.now();
|
|
5151
5151
|
conversation_doc.stat = 3;
|
|
5152
5152
|
conversation_doc.messages.push(obj);
|
|
5153
5153
|
|
|
5154
5154
|
let inputTokens = output?.state?._context.usage?.inputTokens || 0;
|
|
5155
5155
|
let outputTokens = output?.state?._context?.usage?.outputTokens || 0;
|
|
5156
|
-
|
|
5157
|
-
for (const item of output?.
|
|
5156
|
+
|
|
5157
|
+
for (const item of output?.state?._modelResponses || []) {
|
|
5158
5158
|
inputTokens += item.usage.inputTokens;
|
|
5159
5159
|
outputTokens += item.usage.outputTokens;
|
|
5160
5160
|
}
|