@xuda.io/ai_module 1.1.5639 → 1.1.5640

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 (3) hide show
  1. package/index.mjs +5 -19
  2. package/old.mjs +0 -1
  3. package/package.json +1 -1
package/index.mjs CHANGED
@@ -413,7 +413,6 @@ const get_studio_table_info_tool = tool({
413
413
  async execute(e, RunContext) {
414
414
  const { table } = e;
415
415
  const { app_id, uid } = RunContext.context;
416
- debugger;
417
416
  if (!table) throw new Error('got null in the table parameter');
418
417
 
419
418
  try {
@@ -558,7 +557,6 @@ const fetch_data_tool = tool({
558
557
  }
559
558
 
560
559
  const validateQuery_result = validateQueryAgainstTable(query_obj, table_doc.tableFields);
561
- debugger;
562
560
  if (!validateQuery_result.isValid) {
563
561
  // console.error('Validation failed:', validateQuery_result.errors);
564
562
  throw new Error(`Validation failed: ${JSON.stringify(validateQuery_result.errors)}`);
@@ -795,7 +793,6 @@ const create_index_tool = tool({
795
793
  const { index } = e;
796
794
  const { app_id, uid } = RunContext.context;
797
795
  try {
798
- debugger;
799
796
  const index_obj = JSON5.parse(index);
800
797
  console.log('Create Index', index_obj);
801
798
  const project_db = await get_project_db(app_id);
@@ -3993,7 +3990,6 @@ export const update_ai_agent_properties = async function (doc, app_id, uid, fiel
3993
3990
  db_doc.agentConfig.agent_industry = await get_agent_industry();
3994
3991
  db_doc.studio_meta.agent_industry = db_doc.agentConfig.agent_industry;
3995
3992
  }
3996
- debugger;
3997
3993
  if (db_doc.agentConfig.agent_user_guide && (fields_changed.agent_user_guide_changed || fields_changed.all)) {
3998
3994
  db_doc.agentConfig.agent_user_guide_fields = await get_agent_user_guide_fields();
3999
3995
  db_doc.studio_meta.agent_user_guide_fields = db_doc.agentConfig.agent_user_guide_fields;
@@ -4122,7 +4118,6 @@ export const update_thumbnail = async function (type, doc, app_id, uid, job_id,
4122
4118
  }
4123
4119
  return save_ret;
4124
4120
  } catch (error) {
4125
- debugger;
4126
4121
  }
4127
4122
  // }, 500);
4128
4123
  };
@@ -5067,7 +5062,6 @@ export const create_conversation = async function (req, job_id, headers) {
5067
5062
 
5068
5063
  return save_ret;
5069
5064
  } catch (err) {
5070
- debugger;
5071
5065
 
5072
5066
  return { code: -5, data: err.message || String(err) };
5073
5067
  }
@@ -5324,7 +5318,6 @@ const update_conversation_mood_level = async function (uid, target_contacts = []
5324
5318
  }
5325
5319
  }
5326
5320
  } catch (err) {
5327
- debugger;
5328
5321
  }
5329
5322
  };
5330
5323
 
@@ -7292,7 +7285,6 @@ Hard restrictions:
7292
7285
  }
7293
7286
 
7294
7287
  try {
7295
- debugger;
7296
7288
  const api_allow_methods = Object.keys(_conf.cpi_methods);
7297
7289
  for (const method_name of api_allow_methods || []) {
7298
7290
  const method_prop = _conf.cpi_methods[method_name];
@@ -7347,7 +7339,6 @@ Hard restrictions:
7347
7339
  inputSchema[key] = get_z_item(key, val);
7348
7340
  }
7349
7341
  } catch (error) {
7350
- debugger;
7351
7342
  }
7352
7343
  }
7353
7344
  try {
@@ -7379,11 +7370,9 @@ Hard restrictions:
7379
7370
  }),
7380
7371
  );
7381
7372
  } catch (error) {
7382
- debugger;
7383
7373
  }
7384
7374
  }
7385
7375
  } catch (error) {
7386
- debugger;
7387
7376
  }
7388
7377
  break;
7389
7378
  }
@@ -7454,7 +7443,6 @@ Hard restrictions:
7454
7443
  numGenerations: z.number().int().describe('Number generations to image create.').default(3),
7455
7444
  }),
7456
7445
  async execute(e, RunContext) {
7457
- debugger;
7458
7446
  const { prompt, numGenerations } = e;
7459
7447
 
7460
7448
  try {
@@ -7838,7 +7826,6 @@ const ai_chat_conversation = async function (req, job_id, headers) {
7838
7826
  });
7839
7827
 
7840
7828
  agent.on('agent_tool_start', (context, tool, details) => {
7841
- debugger;
7842
7829
  // emitToDashboard('agent_tool_start', tool.name);
7843
7830
  emitToDashboard('stream_phase', `Starting ${tool?.name?.replaceAll('_', ' ')} tool`, { update: true });
7844
7831
  });
@@ -7997,13 +7984,11 @@ const ai_chat_conversation = async function (req, job_id, headers) {
7997
7984
  if (!prompt_suggestion_activated) {
7998
7985
  // init_agent_hooks(agent);
7999
7986
  agent.on('onToolStart', (context, tool, details) => {
8000
- debugger;
8001
7987
  // emitToDashboard('agent_tool_start', tool.name);
8002
7988
  // emitToDashboard('stream_phase', `Starting ${tool.name} tool`);
8003
7989
  });
8004
7990
 
8005
7991
  agent.on('onToolEnd', (context, tool, details) => {
8006
- debugger;
8007
7992
  // emitToDashboard('agent_tool_start', tool.name);
8008
7993
  // emitToDashboard('stream_phase', `Starting ${tool.name} tool`);
8009
7994
  });
@@ -8148,7 +8133,6 @@ const ai_chat_conversation = async function (req, job_id, headers) {
8148
8133
  emitToDashboard('stream_phase', 'Submitting chat', { update: true });
8149
8134
  init_agent_hooks(_agent);
8150
8135
  // const output = await runner.run(_agent, prompt, opt);
8151
- debugger;
8152
8136
  const output = await run_agent(_agent, prompt, opt);
8153
8137
  const done = async function (output) {
8154
8138
  try {
@@ -8196,7 +8180,6 @@ const ai_chat_conversation = async function (req, job_id, headers) {
8196
8180
  // }
8197
8181
  const save_ret = await db_module.save_app_couch_doc_native(account_profile_info.app_id, in_conversation_item_obj);
8198
8182
 
8199
- debugger;
8200
8183
 
8201
8184
  let conversation_items = await client.conversations.items.list(conversation_doc.reference_conversation_id, { order: 'asc', after: last_conversation_item });
8202
8185
 
@@ -8218,7 +8201,6 @@ const ai_chat_conversation = async function (req, job_id, headers) {
8218
8201
 
8219
8202
  return save_ret;
8220
8203
  } catch (error) {
8221
- debugger;
8222
8204
  }
8223
8205
  // }
8224
8206
 
@@ -8283,7 +8265,6 @@ const ai_chat_conversation = async function (req, job_id, headers) {
8283
8265
  };
8284
8266
  // }
8285
8267
  } catch (err) {
8286
- debugger;
8287
8268
 
8288
8269
  conversation_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, conversation_id);
8289
8270
  conversation_doc.ts = Date.now();
@@ -8387,6 +8368,11 @@ const auto_response = async function (uid, profile_id, contact_id, conversation_
8387
8368
 
8388
8369
  let account_doc = await db_module.get_couch_doc_native('xuda_accounts', uid);
8389
8370
 
8371
+ // The main profile is the account's OWN identity: never auto-respond on it
8372
+ // (you don't auto-reply to yourself). Authoritative check via the account's
8373
+ // account_profile_id, independent of the stored auto_respond flag.
8374
+ if (account_doc?.account_profile_id && profile_id === account_doc.account_profile_id) return;
8375
+
8390
8376
  if (account_profile_doc.auto_respond_mode === 'when_offline' && account_doc.socket_id) return;
8391
8377
  if (!['always', 'when_offline'].includes(account_profile_doc.auto_respond_mode)) return;
8392
8378
 
package/old.mjs CHANGED
@@ -580,7 +580,6 @@ async function testTool(app_id, uid) {
580
580
 
581
581
  console.log('Input:', JSON.stringify(input, null, 2));
582
582
  console.log('RunContext:', JSON.stringify(runContext, null, 2));
583
- debugger;
584
583
  // CORRECT ORDER: input first, then runContext
585
584
  const result = await get_studio_table_info_by_table_id_tool.invoke(
586
585
  runContext, // 1st: context
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.5639",
3
+ "version": "1.1.5640",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",