@xuda.io/ai_module 1.1.3929 → 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.
- package/index.mjs +15 -5
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1910,7 +1910,7 @@ export const get_ai_chats = async function (req, job_id, headers) {
|
|
|
1910
1910
|
docs.push(doc);
|
|
1911
1911
|
}
|
|
1912
1912
|
|
|
1913
|
-
return { code: 2, data: { docs: [...requests_from.docs, ...docs], total_docs: ai_chats.total_docs } };
|
|
1913
|
+
return { code: 2, data: { docs: [...requests_from.docs, ...docs], total_docs: ai_chats.total_docs + requests_from.total_docs.total_docs } };
|
|
1914
1914
|
} catch (err) {
|
|
1915
1915
|
return { code: -2, data: err.message };
|
|
1916
1916
|
}
|
|
@@ -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
|
-
|
|
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);
|
|
@@ -2854,7 +2864,7 @@ export const get_apps = async function (req, job_id, headers) {
|
|
|
2854
2864
|
docs.push(doc);
|
|
2855
2865
|
}
|
|
2856
2866
|
|
|
2857
|
-
return { code: 2, data: { docs: [...requests_from.docs, ...docs], total_docs: user_apps.total_docs + requests_from.total_docs.
|
|
2867
|
+
return { code: 2, data: { docs: [...requests_from.docs, ...docs], total_docs: user_apps.total_docs + requests_from.total_docs.total_docs } };
|
|
2858
2868
|
} catch (err) {
|
|
2859
2869
|
return { code: -11, data: err.message };
|
|
2860
2870
|
}
|