@xuda.io/ai_module 1.1.3930 → 1.1.3931

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 +13 -3
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -2447,13 +2447,23 @@ export const get_ai_agents = async function (req, job_id, headers) {
2447
2447
 
2448
2448
  const app_id = await account_module.get_account_default_project_id(uid);
2449
2449
 
2450
- let user_agents = { docs: [] };
2450
+ let user_agents = { docs: [], total_docs: 0 };
2451
2451
  if (filter_type !== 'pending') {
2452
- user_agents = await db_module.find_app_couch_query(app_id, opt);
2452
+ if (!limit || ai_agent_id) {
2453
+ user_agents = await db_module.find_app_couch_query(app_id, opt);
2454
+ }
2455
+ } else {
2456
+ delete opt.sort;
2457
+ delete opt.skip;
2458
+ opt.limit = 9999;
2459
+ opt.fields = ['_id'];
2460
+
2461
+ const counter = await db_module.find_app_couch_query(app_id, opt);
2462
+ user_agents.total_docs = counter.docs.length;
2453
2463
  }
2454
2464
 
2455
2465
  ////// FROM - IN
2456
- let requests_from = { docs: [] };
2466
+ let requests_from = { docs: [], total_docs: 0 };
2457
2467
  if (filter_type === 'pending') {
2458
2468
  const from_opt = { selector: { docType: 'team_request', access_type: 'ai_agent', team_req_stat: 2, team_req_to_uid: uid }, fields: ['_id', 'team_req_date', 'sender_account_info.email', 'team_req_from_uid', 'share_item_id'] };
2459
2469
  const requests_from_res = await db_module.find_couch_query('xuda_team', from_opt);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.3930",
3
+ "version": "1.1.3931",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",