@xuda.io/ai_module 1.1.5166 → 1.1.5168

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 -11
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -4053,7 +4053,7 @@ const ai_chat_conversation = async function (req, job_id, headers) {
4053
4053
  const reference_type = conversation_doc.reference_type;
4054
4054
  const reference_id = conversation_doc.reference_id;
4055
4055
 
4056
- const activate_prompt_suggestions = _.isArray(ai_agents) && conversation_doc.reference_type !== 'ai_agents';
4056
+ const activate_prompt_suggestions = _.isArray(ai_agents) && conversation_doc.reference_type !== 'ai_agents' && !conversation_item_id;
4057
4057
 
4058
4058
  let model = ai_model;
4059
4059
  if (!_conf.ai_models[model]) {
@@ -4121,7 +4121,7 @@ const ai_chat_conversation = async function (req, job_id, headers) {
4121
4121
  };
4122
4122
 
4123
4123
  try {
4124
- if (out_conversation_item_save_ret.code < 0) throw new Error(out_conversation_item_save_ret.data);
4124
+ if (!conversation_item_id && out_conversation_item_save_ret.code < 0) throw new Error(out_conversation_item_save_ret.data);
4125
4125
 
4126
4126
  if (conversation_item_id) {
4127
4127
  const conversation_item_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, conversation_item_id);
@@ -4166,20 +4166,12 @@ const ai_chat_conversation = async function (req, job_id, headers) {
4166
4166
  // await _utils.delay(500);
4167
4167
  await update_job('initiating conversation');
4168
4168
  let prompt_suggestions = [];
4169
- // setTimeout(async () => {
4170
- // if (!activate_prompt_suggestions) return;
4171
- // const prompt_suggestions_ret = await get_chat_suggestions(uid, ai_agents, out_conversation_item_save_ret.data.id);
4172
- // debugger;
4173
- // if (prompt_suggestions_ret.code > -1) prompt_suggestions = prompt_suggestions_ret.data;
4174
- // }, 1);
4175
- // let conversation_doc = await db_module.get_app_couch_doc_native(app_id, conversation_id);
4176
- // const reference_type = conversation_doc.reference_type;
4177
- // const reference_id = conversation_doc.reference_id;
4178
4169
 
4179
4170
  const suggestionsPromise = activate_prompt_suggestions ? get_chat_suggestions({ uid, ai_agents, conversation_item_id: out_conversation_item_save_ret.data.id }) : Promise.resolve(null);
4180
4171
 
4181
4172
  conversation_doc.stat = 2;
4182
4173
  conversation_doc.ts = Date.now();
4174
+ conversation_doc.ai_agents = ai_agents;
4183
4175
  await db_module.save_app_couch_doc_native(account_profile_info.app_id, conversation_doc);
4184
4176
 
4185
4177
  await update_job('analyzing request');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.5166",
3
+ "version": "1.1.5168",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",