@xuda.io/ai_module 1.1.4246 → 1.1.4248

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 +3 -1
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -5120,7 +5120,7 @@ const ai_chat_conversation = async function (req, job_id, headers) {
5120
5120
  const output = await runner.run(_agent, prompt, opt);
5121
5121
  const done = async function (output) {
5122
5122
  try {
5123
- const obj = { id: output?.output?.[0]?.id, ts: Date.now(), ai_agent_id: output.state._currentAgent.name, attachments };
5123
+ const obj = { id: output?.output?.[0]?.id, ts: Date.now(), ai_agent_id: output.state._currentAgent.name, attachments, conversation_type: 'ai_chat' };
5124
5124
  conversation_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, conversation_id);
5125
5125
 
5126
5126
  conversation_doc.ts = Date.now();
@@ -5136,6 +5136,8 @@ const ai_chat_conversation = async function (req, job_id, headers) {
5136
5136
  }
5137
5137
 
5138
5138
  await db_module.save_app_couch_doc_native(account_profile_info.app_id, conversation_doc);
5139
+ await db_module.save_app_couch_doc_native(account_profile_info.app_id, { _id: obj.id, stat: 3, docType: 'chat_conversation_item', uid, conversation_type: obj.conversation_type, date_created_ts: obj.ts, conversation_id, response: output.output });
5140
+
5139
5141
  record_chat_usage(uid, inputTokens, outputTokens, 'conversation chat', prompt, model, { conversation_id, ai_agent_id: obj.ai_agent_id, item_id: obj.id });
5140
5142
  // if (!conversation_doc.chat_image && (!conversation_doc.thumbnail_request_ts || Date.now() - conversation_doc.thumbnail_request_ts > 120000)) {
5141
5143
  // update_thumbnail('conversation', conversation_doc, app_id, uid, job_id, headers);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.4246",
3
+ "version": "1.1.4248",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",