@xuda.io/ai_module 1.1.4162 → 1.1.4164
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 +11 -5
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -2383,6 +2383,8 @@ export const get_ai_agent_info = async function (uid, job_id, headers, doc, from
|
|
|
2383
2383
|
};
|
|
2384
2384
|
|
|
2385
2385
|
const get_user_ai_agents = async function (uid) {
|
|
2386
|
+
const account_profile_info = await account_module.get_active_account_profile_info(uid);
|
|
2387
|
+
|
|
2386
2388
|
const app_id = await account_module.get_account_default_project_id(uid);
|
|
2387
2389
|
let opt = {
|
|
2388
2390
|
selector: {
|
|
@@ -2391,7 +2393,7 @@ const get_user_ai_agents = async function (uid) {
|
|
|
2391
2393
|
'properties.menuType': 'ai_agent',
|
|
2392
2394
|
},
|
|
2393
2395
|
};
|
|
2394
|
-
return await db_module.find_app_couch_query(app_id, opt);
|
|
2396
|
+
return await db_module.find_app_couch_query(account_profile_info.app_id, opt);
|
|
2395
2397
|
};
|
|
2396
2398
|
|
|
2397
2399
|
export const get_ai_agents = async function (req, job_id, headers) {
|
|
@@ -2476,11 +2478,13 @@ export const get_ai_agents = async function (req, job_id, headers) {
|
|
|
2476
2478
|
}
|
|
2477
2479
|
//////////////
|
|
2478
2480
|
|
|
2481
|
+
const account_profile_info = await account_module.get_active_account_profile_info(uid);
|
|
2482
|
+
|
|
2479
2483
|
const app_id = await account_module.get_account_default_project_id(uid);
|
|
2480
2484
|
|
|
2481
2485
|
let user_agents = { docs: [], total_docs: 0 };
|
|
2482
2486
|
if (filter_type !== 'pending') {
|
|
2483
|
-
user_agents = await db_module.find_app_couch_query(app_id, opt);
|
|
2487
|
+
user_agents = await db_module.find_app_couch_query(account_profile_info.app_id, opt);
|
|
2484
2488
|
if (!limit || agent_id) {
|
|
2485
2489
|
user_agents.total_docs = user_agents.docs.length;
|
|
2486
2490
|
} else {
|
|
@@ -2489,7 +2493,7 @@ export const get_ai_agents = async function (req, job_id, headers) {
|
|
|
2489
2493
|
opt.limit = 9999;
|
|
2490
2494
|
opt.fields = ['_id'];
|
|
2491
2495
|
|
|
2492
|
-
const counter = await db_module.find_app_couch_query(app_id, opt);
|
|
2496
|
+
const counter = await db_module.find_app_couch_query(account_profile_info.app_id, opt);
|
|
2493
2497
|
user_agents.total_docs = counter.docs.length;
|
|
2494
2498
|
}
|
|
2495
2499
|
}
|
|
@@ -2598,10 +2602,12 @@ export const delete_ai_agent = async function (req) {
|
|
|
2598
2602
|
export const uninstall_ai_agent = async function (req) {
|
|
2599
2603
|
let { agent_id, uid } = req;
|
|
2600
2604
|
|
|
2605
|
+
const account_profile_info = await account_module.get_active_account_profile_info(uid);
|
|
2606
|
+
|
|
2601
2607
|
const app_id = await account_module.get_account_default_project_id(uid);
|
|
2602
2608
|
|
|
2603
2609
|
try {
|
|
2604
|
-
let agent_doc = await db_module.get_app_couch_doc_native(app_id, agent_id);
|
|
2610
|
+
let agent_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, agent_id);
|
|
2605
2611
|
|
|
2606
2612
|
if (!agent_doc.studio_meta.installed_from_app_id) {
|
|
2607
2613
|
throw new Error('agent not installed');
|
|
@@ -2610,7 +2616,7 @@ export const uninstall_ai_agent = async function (req) {
|
|
|
2610
2616
|
agent_doc.stat = 4;
|
|
2611
2617
|
agent_doc.ts = Date.now();
|
|
2612
2618
|
|
|
2613
|
-
const save_ret = await db_module.save_app_couch_doc(app_id, agent_doc);
|
|
2619
|
+
const save_ret = await db_module.save_app_couch_doc(account_profile_info.app_id, agent_doc);
|
|
2614
2620
|
|
|
2615
2621
|
return save_ret;
|
|
2616
2622
|
} catch (err) {
|