@xuda.io/ai_module 1.1.4163 → 1.1.4165
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 +12 -6
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -2478,11 +2478,13 @@ export const get_ai_agents = async function (req, job_id, headers) {
|
|
|
2478
2478
|
}
|
|
2479
2479
|
//////////////
|
|
2480
2480
|
|
|
2481
|
+
const account_profile_info = await account_module.get_active_account_profile_info(uid);
|
|
2482
|
+
|
|
2481
2483
|
const app_id = await account_module.get_account_default_project_id(uid);
|
|
2482
2484
|
|
|
2483
2485
|
let user_agents = { docs: [], total_docs: 0 };
|
|
2484
2486
|
if (filter_type !== 'pending') {
|
|
2485
|
-
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);
|
|
2486
2488
|
if (!limit || agent_id) {
|
|
2487
2489
|
user_agents.total_docs = user_agents.docs.length;
|
|
2488
2490
|
} else {
|
|
@@ -2491,7 +2493,7 @@ export const get_ai_agents = async function (req, job_id, headers) {
|
|
|
2491
2493
|
opt.limit = 9999;
|
|
2492
2494
|
opt.fields = ['_id'];
|
|
2493
2495
|
|
|
2494
|
-
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);
|
|
2495
2497
|
user_agents.total_docs = counter.docs.length;
|
|
2496
2498
|
}
|
|
2497
2499
|
}
|
|
@@ -2600,10 +2602,12 @@ export const delete_ai_agent = async function (req) {
|
|
|
2600
2602
|
export const uninstall_ai_agent = async function (req) {
|
|
2601
2603
|
let { agent_id, uid } = req;
|
|
2602
2604
|
|
|
2605
|
+
const account_profile_info = await account_module.get_active_account_profile_info(uid);
|
|
2606
|
+
|
|
2603
2607
|
const app_id = await account_module.get_account_default_project_id(uid);
|
|
2604
2608
|
|
|
2605
2609
|
try {
|
|
2606
|
-
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);
|
|
2607
2611
|
|
|
2608
2612
|
if (!agent_doc.studio_meta.installed_from_app_id) {
|
|
2609
2613
|
throw new Error('agent not installed');
|
|
@@ -2612,7 +2616,7 @@ export const uninstall_ai_agent = async function (req) {
|
|
|
2612
2616
|
agent_doc.stat = 4;
|
|
2613
2617
|
agent_doc.ts = Date.now();
|
|
2614
2618
|
|
|
2615
|
-
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);
|
|
2616
2620
|
|
|
2617
2621
|
return save_ret;
|
|
2618
2622
|
} catch (err) {
|
|
@@ -2622,10 +2626,12 @@ export const uninstall_ai_agent = async function (req) {
|
|
|
2622
2626
|
export const unarchive_ai_agent = async function (req) {
|
|
2623
2627
|
let { agent_id, uid } = req;
|
|
2624
2628
|
|
|
2629
|
+
const account_profile_info = await account_module.get_active_account_profile_info(uid);
|
|
2630
|
+
|
|
2625
2631
|
const app_id = await account_module.get_account_default_project_id(uid);
|
|
2626
2632
|
|
|
2627
2633
|
try {
|
|
2628
|
-
let agent_doc = await db_module.get_app_couch_doc_native(app_id, agent_id);
|
|
2634
|
+
let agent_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, agent_id);
|
|
2629
2635
|
|
|
2630
2636
|
if (agent_doc.stat !== 5) {
|
|
2631
2637
|
throw new Error('agent is not archived');
|
|
@@ -2634,7 +2640,7 @@ export const unarchive_ai_agent = async function (req) {
|
|
|
2634
2640
|
agent_doc.stat = 3;
|
|
2635
2641
|
agent_doc.ts = Date.now();
|
|
2636
2642
|
|
|
2637
|
-
const save_ret = await db_module.save_app_couch_doc(app_id, agent_doc);
|
|
2643
|
+
const save_ret = await db_module.save_app_couch_doc(account_profile_info.app_id, agent_doc);
|
|
2638
2644
|
|
|
2639
2645
|
return save_ret;
|
|
2640
2646
|
} catch (err) {
|