@xuda.io/ai_module 1.1.3607 → 1.1.3609
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 +31 -29
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -2390,26 +2390,27 @@ export const get_ai_agents = async function (req, job_id, headers) {
|
|
|
2390
2390
|
|
|
2391
2391
|
////// FROM - IN
|
|
2392
2392
|
let requests_from = { docs: [] };
|
|
2393
|
+
if (filter_type === 'pending') {
|
|
2394
|
+
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'] };
|
|
2395
|
+
const requests_from_res = await db_module.find_couch_query('xuda_team', from_opt);
|
|
2393
2396
|
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
// for await (let e of requests_from_res.docs) {
|
|
2398
|
-
// let doc = { ts: e.team_req_date, pending: true, properties: {}, studio_meta: { createdByUid: e.team_req_from_uid }, team_req_id: e._id };
|
|
2397
|
+
for await (let e of requests_from_res.docs) {
|
|
2398
|
+
let doc = { ts: e.team_req_date, pending: true, properties: {}, studio_meta: { createdByUid: e.team_req_from_uid }, team_req_id: e._id };
|
|
2399
2399
|
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2400
|
+
if (e.team_req_from_uid) {
|
|
2401
|
+
doc.user_contact = await account_module.get_user_card(uid, e.team_req_from_uid);
|
|
2402
|
+
doc.icon_pattern = doc.user_contact.profile_avatar;
|
|
2403
|
+
}
|
|
2404
2404
|
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2405
|
+
//share_item_id
|
|
2406
|
+
const app_id = await account_module.get_account_default_project_id(e.team_req_from_uid);
|
|
2407
|
+
const miniapp_ret = await db_module.get_app_couch_doc_native(app_id, e.share_item_id);
|
|
2408
|
+
doc.properties.menuName = miniapp_ret.properties.menuName;
|
|
2409
|
+
doc.studio_meta.agent_image = miniapp_ret.studio_meta.agent_image;
|
|
2410
2410
|
|
|
2411
|
-
|
|
2412
|
-
|
|
2411
|
+
requests_from.docs.push(doc);
|
|
2412
|
+
}
|
|
2413
|
+
}
|
|
2413
2414
|
|
|
2414
2415
|
//////////////////////
|
|
2415
2416
|
|
|
@@ -2691,23 +2692,24 @@ export const get_apps = async function (req, job_id, headers) {
|
|
|
2691
2692
|
///////////////
|
|
2692
2693
|
////// FROM - IN
|
|
2693
2694
|
let requests_from = { docs: [] };
|
|
2695
|
+
if (filter_type === 'pending') {
|
|
2696
|
+
const from_opt = { selector: { docType: 'team_request', access_type: 'miniapp', 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'] };
|
|
2697
|
+
const requests_from_res = await db_module.find_couch_query('xuda_team', from_opt);
|
|
2694
2698
|
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
for await (let e of requests_from_res.docs) {
|
|
2699
|
-
//account_info
|
|
2699
|
+
for await (let e of requests_from_res.docs) {
|
|
2700
|
+
//account_info
|
|
2700
2701
|
|
|
2701
|
-
|
|
2702
|
+
let doc = { ts: e.team_req_date, pending: true, properties: {}, studio_meta: { createdByUid: e.team_req_from_uid }, team_req_id: e._id };
|
|
2702
2703
|
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2704
|
+
if (e.team_req_from_uid) {
|
|
2705
|
+
// const account_info_ret = await account_module.get_account_name({ uid_query: e.team_req_from_uid });
|
|
2706
|
+
// if (account_info_ret.code < 0) {
|
|
2707
|
+
// continue; // throw new Error(`account ${contact_uid} not found`);
|
|
2708
|
+
// }
|
|
2708
2709
|
|
|
2709
|
-
|
|
2710
|
-
|
|
2710
|
+
// doc.account_info = account_info_ret.data;
|
|
2711
|
+
doc.user_contact = await account_module.get_user_card(uid, e.team_req_from_uid);
|
|
2712
|
+
}
|
|
2711
2713
|
}
|
|
2712
2714
|
|
|
2713
2715
|
//share_item_id
|