@xuda.io/ai_module 1.1.5259 → 1.1.5261

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 +12 -6
  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...');
@@ -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);
@@ -11045,6 +11047,10 @@ export const get_chat_suggestions = async function (req) {
11045
11047
  const conversation_item_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, conversation_item_id);
11046
11048
  const conversation_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, conversation_item_doc.conversation_id);
11047
11049
 
11050
+ if (conversation_item_doc.prompt_selected_suggestion) {
11051
+ exclude_agents = conversation_item_doc.prompt_selected_suggestion.map((agent) => agent.agent_id);
11052
+ }
11053
+
11048
11054
  const get_agents = async function () {
11049
11055
  if (typeof ai_agents === 'undefined') {
11050
11056
  // no agents
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.5259",
3
+ "version": "1.1.5261",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",