@xuda.io/ai_module 1.1.4166 → 1.1.4167
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 +25 -24
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -2711,9 +2711,10 @@ export const unarchive_mini_app = async function (req) {
|
|
|
2711
2711
|
export const delete_mini_app = async function (req) {
|
|
2712
2712
|
let { prog_id, uid } = req;
|
|
2713
2713
|
|
|
2714
|
+
const account_profile_info = await account_module.get_active_account_profile_info(uid);
|
|
2714
2715
|
const app_id = await account_module.get_account_default_project_id(uid);
|
|
2715
2716
|
try {
|
|
2716
|
-
let prog_doc = await db_module.get_app_couch_doc_native(app_id, prog_id);
|
|
2717
|
+
let prog_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, prog_id);
|
|
2717
2718
|
|
|
2718
2719
|
if (prog_doc.stat !== 5) {
|
|
2719
2720
|
throw new Error('A document can only be deleted after it has been archived');
|
|
@@ -2727,7 +2728,7 @@ export const delete_mini_app = async function (req) {
|
|
|
2727
2728
|
} else {
|
|
2728
2729
|
prog_doc.stat = 4;
|
|
2729
2730
|
prog_doc.ts = Date.now();
|
|
2730
|
-
save_ret = await db_module.save_app_couch_doc(app_id, prog_doc);
|
|
2731
|
+
save_ret = await db_module.save_app_couch_doc(account_profile_info.app_id, prog_doc);
|
|
2731
2732
|
delete_depended_chats(uid, prog_id);
|
|
2732
2733
|
}
|
|
2733
2734
|
return save_ret;
|
|
@@ -2780,29 +2781,29 @@ export const update_ai_agent = async function (req, job_id, headers) {
|
|
|
2780
2781
|
}
|
|
2781
2782
|
};
|
|
2782
2783
|
|
|
2783
|
-
export const install_ai_agent = async function (req) {
|
|
2784
|
-
|
|
2784
|
+
// export const install_ai_agent = async function (req) {
|
|
2785
|
+
// let { agent_id, agent_uid, uid } = req;
|
|
2785
2786
|
|
|
2786
|
-
|
|
2787
|
-
|
|
2787
|
+
// const source_project_db = await get_account_project_db(agent_uid);
|
|
2788
|
+
// const target_project_db = await get_account_project_db(uid);
|
|
2788
2789
|
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2790
|
+
// try {
|
|
2791
|
+
// let agent_doc = await source_project_db.get(agent_id);
|
|
2792
|
+
// if (agent_doc.agentConfig.agent_visibility === 'private') {
|
|
2793
|
+
// throw new Error('agent is private');
|
|
2794
|
+
// }
|
|
2795
|
+
// const t = Date.now();
|
|
2796
|
+
// agent_doc.ts = t;
|
|
2797
|
+
// agent_doc.studio_meta.installed_ts = t;
|
|
2798
|
+
// agent_doc.studio_meta.installed_from_app_id = await account_module.get_account_default_project_id(agent_uid);
|
|
2798
2799
|
|
|
2799
|
-
|
|
2800
|
+
// const data = await target_project_db.insert(agent_doc);
|
|
2800
2801
|
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
};
|
|
2802
|
+
// return { code: 10, data };
|
|
2803
|
+
// } catch (err) {
|
|
2804
|
+
// return { code: -10, data: err.message };
|
|
2805
|
+
// }
|
|
2806
|
+
// };
|
|
2806
2807
|
|
|
2807
2808
|
export const get_apps = async function (req, job_id, headers) {
|
|
2808
2809
|
let { uid, _id, search, filter_type = 'all', limit, skip, mini_app_id } = req;
|
|
@@ -2869,12 +2870,12 @@ export const get_apps = async function (req, job_id, headers) {
|
|
|
2869
2870
|
opt.selector._id = mini_app_id;
|
|
2870
2871
|
}
|
|
2871
2872
|
//////////////
|
|
2872
|
-
|
|
2873
|
+
const account_profile_info = await account_module.get_active_account_profile_info(uid);
|
|
2873
2874
|
const app_id = await account_module.get_account_default_project_id(uid);
|
|
2874
2875
|
|
|
2875
2876
|
let user_apps = { docs: [], total_docs: 0 };
|
|
2876
2877
|
if (filter_type !== 'pending') {
|
|
2877
|
-
user_apps = await db_module.find_app_couch_query(app_id, opt);
|
|
2878
|
+
user_apps = await db_module.find_app_couch_query(account_profile_info.app_id, opt);
|
|
2878
2879
|
if (!limit || mini_app_id) {
|
|
2879
2880
|
user_apps.total_docs = user_apps.docs.length;
|
|
2880
2881
|
} else {
|
|
@@ -2883,7 +2884,7 @@ export const get_apps = async function (req, job_id, headers) {
|
|
|
2883
2884
|
opt.limit = 9999;
|
|
2884
2885
|
opt.fields = ['_id'];
|
|
2885
2886
|
|
|
2886
|
-
const counter = await db_module.find_app_couch_query(app_id, opt);
|
|
2887
|
+
const counter = await db_module.find_app_couch_query(account_profile_info.app_id, opt);
|
|
2887
2888
|
user_apps.total_docs = counter.docs.length;
|
|
2888
2889
|
}
|
|
2889
2890
|
}
|