@xuda.io/ai_module 1.1.5257 → 1.1.5259

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 +7 -5
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -4181,6 +4181,7 @@ const ai_chat_conversation = async function (req, job_id, headers) {
4181
4181
  // await _utils.delay(500);
4182
4182
  await update_job('initiating conversation');
4183
4183
  let prompt_suggestions = [];
4184
+ let selected_suggestion;
4184
4185
 
4185
4186
  const get_prompt_suggestions = async function () {
4186
4187
  emitToDashboard('stream_delta', 'Deep thinking...');
@@ -4197,7 +4198,7 @@ const ai_chat_conversation = async function (req, job_id, headers) {
4197
4198
  clearInterval(interval);
4198
4199
  }
4199
4200
  }, 500);
4200
- const ret = await get_chat_suggestions({ uid, ai_agents, conversation_item_id: out_conversation_item_save_ret.data.id, context: prompt });
4201
+ const ret = await get_chat_suggestions({ uid, type: 'chat prompt', ai_agents, conversation_item_id: out_conversation_item_save_ret.data.id, context: prompt });
4201
4202
  clearInterval(interval);
4202
4203
  resolve(ret);
4203
4204
  });
@@ -4207,7 +4208,7 @@ const ai_chat_conversation = async function (req, job_id, headers) {
4207
4208
  debugger;
4208
4209
  console.log('prompt_suggestions', prompt_suggestions);
4209
4210
  const agentIds = prompt_suggestions.map((agent) => agent.agent_id);
4210
- const ret = await get_chat_suggestions({ uid, ai_agents, conversation_item_id: response_conversation_item_id, exclude_agents: agentIds });
4211
+ const ret = await get_chat_suggestions({ uid, type: 'chat response', ai_agents, conversation_item_id: response_conversation_item_id, exclude_agents: agentIds });
4211
4212
 
4212
4213
  if (ret && ret.code > -1) {
4213
4214
  emitToDashboard('suggestions', JSON.stringify(ret.data));
@@ -4790,10 +4791,10 @@ const ai_chat_conversation = async function (req, job_id, headers) {
4790
4791
  }
4791
4792
 
4792
4793
  if (prompt_suggestions.length) {
4793
- const suggestions_agent = await render_suggestions();
4794
- if (suggestions_agent) {
4794
+ selected_suggestion = await render_suggestions();
4795
+ if (selected_suggestion) {
4795
4796
  prompt_suggestion_activated = true;
4796
- ai_agents = suggestions_agent;
4797
+ ai_agents = selected_suggestion;
4797
4798
  agents = await get_agents();
4798
4799
  } else {
4799
4800
  emitToDashboard('response_start');
@@ -4892,6 +4893,7 @@ const ai_chat_conversation = async function (req, job_id, headers) {
4892
4893
  // out_conversation_item_doc.stat = 3;
4893
4894
  out_conversation_item_doc.conversation_item_reference_id = conversation_items?.data?.[0]?.id;
4894
4895
  out_conversation_item_doc.prompt_suggestions = prompt_suggestions;
4896
+ out_conversation_item_doc.selected_suggestion = selected_suggestion;
4895
4897
  await db_module.save_app_couch_doc_native(account_profile_info.app_id, out_conversation_item_doc);
4896
4898
 
4897
4899
  account_msa.record_ai_usage(uid, inputTokens, outputTokens, 'conversation chat', prompt, model, { conversation_id, ai_agent_id: in_conversation_item_obj.ai_agent_id, item_id: in_conversation_item_obj._id }, account_profile_info);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.5257",
3
+ "version": "1.1.5259",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",