@xuda.io/ai_module 1.1.3811 → 1.1.3813

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.
Files changed (2) hide show
  1. package/index.mjs +13 -3
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -5002,12 +5002,12 @@ const ai_chat_conversation = async function (req, job_id, headers) {
5002
5002
 
5003
5003
  // console.log(items.data);
5004
5004
 
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 };
5006
5005
  conversation_doc = await db_module.get_app_couch_doc_native(app_id, conversation_id);
5007
5006
 
5008
5007
  conversation_doc.ts = Date.now();
5009
- conversation_doc.stat = 3;
5010
- conversation_doc.messages.push(obj);
5008
+ conversation_doc.stat = 2;
5009
+ conversation_doc.message = [...conversation_doc.message, ...system_message_items];
5010
+ // s.push(obj);
5011
5011
  await db_module.save_app_couch_doc_native(app_id, conversation_doc);
5012
5012
  };
5013
5013
 
@@ -6241,3 +6241,13 @@ const create_ai_agent_image = async function (req, job_id, headers) {
6241
6241
  }
6242
6242
  }
6243
6243
  };
6244
+
6245
+ const record_chat_usage = async function (uid, input_tokens, output_tokens, msg) {
6246
+ try {
6247
+ const app_id = await account_module.get_account_default_project_id(uid);
6248
+
6249
+ const t = Date.now();
6250
+ } catch (err) {
6251
+ console.error(err);
6252
+ }
6253
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.3811",
3
+ "version": "1.1.3813",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",