@xuda.io/ai_module 1.1.5258 → 1.1.5260

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 +10 -8
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -4181,7 +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
+ let prompt_selected_suggestion;
4185
4185
 
4186
4186
  const get_prompt_suggestions = async function () {
4187
4187
  emitToDashboard('stream_delta', 'Deep thinking...');
@@ -4198,7 +4198,7 @@ const ai_chat_conversation = async function (req, job_id, headers) {
4198
4198
  clearInterval(interval);
4199
4199
  }
4200
4200
  }, 500);
4201
- 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 });
4202
4202
  clearInterval(interval);
4203
4203
  resolve(ret);
4204
4204
  });
@@ -4208,7 +4208,7 @@ const ai_chat_conversation = async function (req, job_id, headers) {
4208
4208
  debugger;
4209
4209
  console.log('prompt_suggestions', prompt_suggestions);
4210
4210
  const agentIds = prompt_suggestions.map((agent) => agent.agent_id);
4211
- 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 });
4212
4212
 
4213
4213
  if (ret && ret.code > -1) {
4214
4214
  emitToDashboard('suggestions', JSON.stringify(ret.data));
@@ -4791,10 +4791,10 @@ const ai_chat_conversation = async function (req, job_id, headers) {
4791
4791
  }
4792
4792
 
4793
4793
  if (prompt_suggestions.length) {
4794
- selected_suggestion = await render_suggestions();
4795
- if (selected_suggestion) {
4794
+ prompt_selected_suggestion = await render_suggestions();
4795
+ if (prompt_selected_suggestion) {
4796
4796
  prompt_suggestion_activated = true;
4797
- ai_agents = selected_suggestion;
4797
+ ai_agents = prompt_selected_suggestion;
4798
4798
  agents = await get_agents();
4799
4799
  } else {
4800
4800
  emitToDashboard('response_start');
@@ -4882,6 +4882,8 @@ const ai_chat_conversation = async function (req, job_id, headers) {
4882
4882
  ai_agent_id: output.state._currentAgent.name,
4883
4883
  job_id,
4884
4884
  prompt_conversation_item_id,
4885
+ prompt_suggestions,
4886
+ prompt_selected_suggestion,
4885
4887
  };
4886
4888
  const save_ret = await db_module.save_app_couch_doc_native(account_profile_info.app_id, in_conversation_item_obj);
4887
4889
 
@@ -4892,8 +4894,8 @@ const ai_chat_conversation = async function (req, job_id, headers) {
4892
4894
  let out_conversation_item_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, out_conversation_item_obj._id);
4893
4895
  // out_conversation_item_doc.stat = 3;
4894
4896
  out_conversation_item_doc.conversation_item_reference_id = conversation_items?.data?.[0]?.id;
4895
- out_conversation_item_doc.prompt_suggestions = prompt_suggestions;
4896
- out_conversation_item_doc.selected_suggestion = selected_suggestion;
4897
+ // out_conversation_item_doc.prompt_suggestions = prompt_suggestions;
4898
+ // out_conversation_item_doc.prompt_selected_suggestion = prompt_selected_suggestion;
4897
4899
  await db_module.save_app_couch_doc_native(account_profile_info.app_id, out_conversation_item_doc);
4898
4900
 
4899
4901
  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.5258",
3
+ "version": "1.1.5260",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",