@xuda.io/ai_module 1.1.5293 → 1.1.5294

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 +8 -10
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -4064,7 +4064,7 @@ const ai_chat_conversation = async function (req, job_id, headers) {
4064
4064
  const reference_type = conversation_doc.reference_type;
4065
4065
  const reference_id = conversation_doc.reference_id;
4066
4066
 
4067
- const activate_prompt_suggestions = _.isArray(ai_agents) && conversation_doc.reference_type !== 'ai_agents' && !conversation_item_id;
4067
+ const activate_prompt_suggestions = _.isArray(local_ai_agents) && conversation_doc.reference_type !== 'ai_agents' && !conversation_item_id;
4068
4068
  let prompt_suggestion_activated;
4069
4069
  let model = ai_model;
4070
4070
  if (!_conf.ai_models[model]) {
@@ -4219,8 +4219,6 @@ const ai_chat_conversation = async function (req, job_id, headers) {
4219
4219
  }
4220
4220
  };
4221
4221
 
4222
- // const suggestionsPromise = activate_prompt_suggestions ? get_chat_suggestions({ uid, ai_agents, conversation_item_id: out_conversation_item_save_ret.data.id, context: prompt }) : Promise.resolve(null);
4223
-
4224
4222
  conversation_doc.stat = 2;
4225
4223
  conversation_doc.ts = Date.now();
4226
4224
  conversation_doc.ai_agents = ai_agents;
@@ -4315,14 +4313,14 @@ const ai_chat_conversation = async function (req, job_id, headers) {
4315
4313
  return is_agent ? identity : triage_assistant + identity;
4316
4314
  };
4317
4315
  const get_agents = async function () {
4318
- if (typeof ai_agents === 'undefined') {
4316
+ if (typeof local_ai_agents === 'undefined') {
4319
4317
  // no agents
4320
- ai_agents = [];
4321
- } else if (!ai_agents.length) {
4318
+ local_ai_agents = [];
4319
+ } else if (!local_ai_agents.length) {
4322
4320
  // auto agent mode
4323
4321
  const ai_agents_ret = await get_user_ai_agents(uid);
4324
4322
  for (const doc of ai_agents_ret.docs) {
4325
- ai_agents.push(doc._id);
4323
+ local_ai_agents.push(doc._id);
4326
4324
  }
4327
4325
  }
4328
4326
 
@@ -4331,12 +4329,12 @@ const ai_chat_conversation = async function (req, job_id, headers) {
4331
4329
  let modelSettings = {};
4332
4330
 
4333
4331
  if (reference_type === 'ai_agents') {
4334
- ai_agents.push(reference_id);
4332
+ local_ai_agents.push(reference_id);
4335
4333
  }
4336
4334
 
4337
4335
  let eligible_agent = true;
4338
4336
 
4339
- for (const agent_id of ai_agents) {
4337
+ for (const agent_id of local_ai_agents) {
4340
4338
  try {
4341
4339
  let ai_agent_doc;
4342
4340
  try {
@@ -4800,7 +4798,7 @@ const ai_chat_conversation = async function (req, job_id, headers) {
4800
4798
  prompt_selected_suggestion = await render_suggestions();
4801
4799
  if (prompt_selected_suggestion) {
4802
4800
  prompt_suggestion_activated = true;
4803
- ai_agents = prompt_selected_suggestion;
4801
+ local_ai_agents = prompt_selected_suggestion;
4804
4802
  agents = await get_agents();
4805
4803
  } else {
4806
4804
  emitToDashboard('response_start');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.5293",
3
+ "version": "1.1.5294",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",