@xuda.io/ai_module 1.1.4164 → 1.1.4166
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 +13 -9
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -2626,10 +2626,12 @@ export const uninstall_ai_agent = async function (req) {
|
|
|
2626
2626
|
export const unarchive_ai_agent = async function (req) {
|
|
2627
2627
|
let { agent_id, uid } = req;
|
|
2628
2628
|
|
|
2629
|
+
const account_profile_info = await account_module.get_active_account_profile_info(uid);
|
|
2630
|
+
|
|
2629
2631
|
const app_id = await account_module.get_account_default_project_id(uid);
|
|
2630
2632
|
|
|
2631
2633
|
try {
|
|
2632
|
-
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);
|
|
2633
2635
|
|
|
2634
2636
|
if (agent_doc.stat !== 5) {
|
|
2635
2637
|
throw new Error('agent is not archived');
|
|
@@ -2638,7 +2640,7 @@ export const unarchive_ai_agent = async function (req) {
|
|
|
2638
2640
|
agent_doc.stat = 3;
|
|
2639
2641
|
agent_doc.ts = Date.now();
|
|
2640
2642
|
|
|
2641
|
-
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);
|
|
2642
2644
|
|
|
2643
2645
|
return save_ret;
|
|
2644
2646
|
} catch (err) {
|
|
@@ -2647,16 +2649,16 @@ export const unarchive_ai_agent = async function (req) {
|
|
|
2647
2649
|
};
|
|
2648
2650
|
export const archive_ai_agent = async function (req) {
|
|
2649
2651
|
let { agent_id, uid } = req;
|
|
2650
|
-
|
|
2652
|
+
const account_profile_info = await account_module.get_active_account_profile_info(uid);
|
|
2651
2653
|
const app_id = await account_module.get_account_default_project_id(uid);
|
|
2652
2654
|
try {
|
|
2653
2655
|
const team_module = await import(`${module_path}/team_module/index.mjs`);
|
|
2654
2656
|
await team_module.validate_share_exist(uid, 'ai_agent', agent_id);
|
|
2655
2657
|
|
|
2656
|
-
let agent_doc = await db_module.get_app_couch_doc_native(app_id, agent_id);
|
|
2658
|
+
let agent_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, agent_id);
|
|
2657
2659
|
agent_doc.stat = 5;
|
|
2658
2660
|
agent_doc.ts = Date.now();
|
|
2659
|
-
const save_ret = await db_module.save_app_couch_doc(app_id, agent_doc);
|
|
2661
|
+
const save_ret = await db_module.save_app_couch_doc(account_profile_info.app_id, agent_doc);
|
|
2660
2662
|
|
|
2661
2663
|
return save_ret;
|
|
2662
2664
|
} catch (err) {
|
|
@@ -2667,15 +2669,16 @@ export const archive_ai_agent = async function (req) {
|
|
|
2667
2669
|
export const archive_mini_app = async function (req) {
|
|
2668
2670
|
let { prog_id, uid } = req;
|
|
2669
2671
|
|
|
2672
|
+
const account_profile_info = await account_module.get_active_account_profile_info(uid);
|
|
2670
2673
|
const app_id = await account_module.get_account_default_project_id(uid);
|
|
2671
2674
|
try {
|
|
2672
2675
|
const team_module = await import(`${module_path}/team_module/index.mjs`);
|
|
2673
2676
|
await team_module.validate_share_exist(uid, 'miniapp', prog_id);
|
|
2674
2677
|
|
|
2675
|
-
let prog_doc = await db_module.get_app_couch_doc_native(app_id, prog_id);
|
|
2678
|
+
let prog_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, prog_id);
|
|
2676
2679
|
prog_doc.stat = 5;
|
|
2677
2680
|
prog_doc.ts = Date.now();
|
|
2678
|
-
const save_ret = await db_module.save_app_couch_doc(app_id, prog_doc);
|
|
2681
|
+
const save_ret = await db_module.save_app_couch_doc(account_profile_info.app_id, prog_doc);
|
|
2679
2682
|
|
|
2680
2683
|
return save_ret;
|
|
2681
2684
|
} catch (err) {
|
|
@@ -2686,9 +2689,10 @@ export const archive_mini_app = async function (req) {
|
|
|
2686
2689
|
export const unarchive_mini_app = async function (req) {
|
|
2687
2690
|
let { prog_id, uid } = req;
|
|
2688
2691
|
|
|
2692
|
+
const account_profile_info = await account_module.get_active_account_profile_info(uid);
|
|
2689
2693
|
const app_id = await account_module.get_account_default_project_id(uid);
|
|
2690
2694
|
try {
|
|
2691
|
-
let prog_doc = await db_module.get_app_couch_doc_native(app_id, prog_id);
|
|
2695
|
+
let prog_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, prog_id);
|
|
2692
2696
|
|
|
2693
2697
|
if (prog_doc.stat !== 5) {
|
|
2694
2698
|
throw new Error('mini app is not archived');
|
|
@@ -2696,7 +2700,7 @@ export const unarchive_mini_app = async function (req) {
|
|
|
2696
2700
|
|
|
2697
2701
|
prog_doc.stat = 3;
|
|
2698
2702
|
prog_doc.ts = Date.now();
|
|
2699
|
-
const save_ret = await db_module.save_app_couch_doc(app_id, prog_doc);
|
|
2703
|
+
const save_ret = await db_module.save_app_couch_doc(account_profile_info.app_id, prog_doc);
|
|
2700
2704
|
|
|
2701
2705
|
return save_ret;
|
|
2702
2706
|
} catch (err) {
|