@xuda.io/ai_module 1.1.5168 → 1.1.5170

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 +29 -4
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -4281,6 +4281,8 @@ const ai_chat_conversation = async function (req, job_id, headers) {
4281
4281
  ai_agents.push(reference_id);
4282
4282
  }
4283
4283
 
4284
+ let eligible_agent = true;
4285
+
4284
4286
  for (const agent_id of ai_agents) {
4285
4287
  try {
4286
4288
  let ai_agent_doc;
@@ -4322,6 +4324,11 @@ const ai_chat_conversation = async function (req, job_id, headers) {
4322
4324
  }
4323
4325
 
4324
4326
  case 'mcp': {
4327
+ if (reference_type !== 'ai_agents') {
4328
+ eligible_agent = false;
4329
+ break;
4330
+ }
4331
+
4325
4332
  tools.push(
4326
4333
  hostedMcpTool({
4327
4334
  serverLabel: 'mcp_' + (val?.name?.replaceAll(' ', '_') || key), //ai_agent_doc.properties.menuName,
@@ -4338,6 +4345,10 @@ const ai_chat_conversation = async function (req, job_id, headers) {
4338
4345
  }
4339
4346
 
4340
4347
  case 'cpi': {
4348
+ if (reference_type !== 'ai_agents') {
4349
+ eligible_agent = false;
4350
+ break;
4351
+ }
4341
4352
  continue;
4342
4353
  try {
4343
4354
  debugger;
@@ -4436,6 +4447,10 @@ const ai_chat_conversation = async function (req, job_id, headers) {
4436
4447
  }
4437
4448
 
4438
4449
  case 'image_generate': {
4450
+ if (reference_type !== 'ai_agents') {
4451
+ eligible_agent = false;
4452
+ break;
4453
+ }
4439
4454
  tools.push(
4440
4455
  tool({
4441
4456
  name: name.substring(0, 60),
@@ -4532,6 +4547,11 @@ const ai_chat_conversation = async function (req, job_id, headers) {
4532
4547
  }
4533
4548
 
4534
4549
  case 'ai_agent': {
4550
+ if (reference_type !== 'ai_agents') {
4551
+ eligible_agent = false;
4552
+ break;
4553
+ }
4554
+
4535
4555
  let opt = {
4536
4556
  selector: {
4537
4557
  docType: 'studio',
@@ -4581,6 +4601,11 @@ const ai_chat_conversation = async function (req, job_id, headers) {
4581
4601
  break;
4582
4602
  }
4583
4603
  case 'plugin': {
4604
+ if (reference_type !== 'ai_agents') {
4605
+ eligible_agent = false;
4606
+ break;
4607
+ }
4608
+
4584
4609
  if (!val.plugin_id) {
4585
4610
  throw new Error('undefined plugin_id');
4586
4611
  }
@@ -4620,10 +4645,10 @@ const ai_chat_conversation = async function (req, job_id, headers) {
4620
4645
  tool_resources,
4621
4646
  modelSettings,
4622
4647
  });
4623
-
4624
- init_agent_hooks(agent);
4625
-
4626
- list.push(agent);
4648
+ if (eligible_agent) {
4649
+ init_agent_hooks(agent);
4650
+ list.push(agent);
4651
+ }
4627
4652
  } catch (err) {
4628
4653
  console.error(err.message);
4629
4654
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.5168",
3
+ "version": "1.1.5170",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",