@xuda.io/ai_module 1.1.5072 → 1.1.5074

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 -5
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -3711,6 +3711,13 @@ export const submit_chat_conversation = async function (req, job_id, headers) {
3711
3711
  } else {
3712
3712
  ret = await ai_chat_conversation(req, job_id, headers);
3713
3713
  }
3714
+
3715
+ if (ret.code > -1) {
3716
+ let conversation_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, conversation_id);
3717
+ conversation_doc.conversation_item_id = ret.data.id;
3718
+ await db_module.save_app_couch_doc(account_profile_info.app_id, conversation_doc);
3719
+ }
3720
+
3714
3721
  return ret;
3715
3722
  } catch (err) {
3716
3723
  return { code: -14, data: err.message || String(err) };
@@ -4696,7 +4703,7 @@ const ai_chat_conversation = async function (req, job_id, headers) {
4696
4703
  role: 'assistant',
4697
4704
  ai_agent_id: output.state._currentAgent.name,
4698
4705
  };
4699
- await db_module.save_app_couch_doc_native(account_profile_info.app_id, in_conversation_item_obj);
4706
+ const save_ret = await db_module.save_app_couch_doc_native(account_profile_info.app_id, in_conversation_item_obj);
4700
4707
 
4701
4708
  debugger;
4702
4709
 
@@ -4757,10 +4764,11 @@ const ai_chat_conversation = async function (req, job_id, headers) {
4757
4764
  await done(output);
4758
4765
  return {
4759
4766
  code: 4,
4760
- data: {
4761
- conversation_doc,
4762
- response: output.output, // output.finalOutput ?? output.output ?? output, // depends on SDK shape
4763
- },
4767
+ data: save_ret,
4768
+ // data: {
4769
+ // conversation_doc,
4770
+ // response: output.output, // output.finalOutput ?? output.output ?? output, // depends on SDK shape
4771
+ // },
4764
4772
  };
4765
4773
  // }
4766
4774
  } catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.5072",
3
+ "version": "1.1.5074",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",