@xuda.io/ai_module 1.1.3608 → 1.1.3610
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 +30 -30
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1809,25 +1809,25 @@ export const get_ai_chats = async function (req, job_id, headers) {
|
|
|
1809
1809
|
let requests_from = { docs: [] };
|
|
1810
1810
|
|
|
1811
1811
|
if (!reference_id) {
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
for await (let e of requests_from_res.docs) {
|
|
1816
|
-
//account_info
|
|
1812
|
+
if (filter_type === 'pending') {
|
|
1813
|
+
const from_opt = { selector: { docType: 'team_request', access_type: 'chat', 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'] };
|
|
1814
|
+
const requests_from_res = await db_module.find_couch_query('xuda_team', from_opt);
|
|
1817
1815
|
|
|
1818
|
-
|
|
1816
|
+
for await (let e of requests_from_res.docs) {
|
|
1817
|
+
let doc = { date_created: e.team_req_date, pending: true, uid: e.team_req_from_uid, team_req_id: e._id };
|
|
1819
1818
|
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1819
|
+
if (e.team_req_from_uid) {
|
|
1820
|
+
doc.user_contact = await account_module.get_user_card(uid, e.team_req_from_uid);
|
|
1821
|
+
}
|
|
1823
1822
|
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1823
|
+
//share_item_id
|
|
1824
|
+
const app_id = await account_module.get_account_default_project_id(e.team_req_from_uid);
|
|
1825
|
+
const chat_ret = await db_module.get_app_couch_doc_native(app_id, e.share_item_id);
|
|
1826
|
+
doc.title = chat_ret.title;
|
|
1827
|
+
doc.chat_image = chat_ret.chat_image;
|
|
1829
1828
|
|
|
1830
|
-
|
|
1829
|
+
requests_from.docs.push(doc);
|
|
1830
|
+
}
|
|
1831
1831
|
}
|
|
1832
1832
|
}
|
|
1833
1833
|
|
|
@@ -1840,9 +1840,8 @@ export const get_ai_chats = async function (req, job_id, headers) {
|
|
|
1840
1840
|
ai_chats = await db_module.find_app_couch_query(app_id, opt);
|
|
1841
1841
|
}
|
|
1842
1842
|
let docs = [];
|
|
1843
|
-
|
|
1843
|
+
|
|
1844
1844
|
for (let doc of ai_chats.docs || []) {
|
|
1845
|
-
// let doc = row.value;
|
|
1846
1845
|
doc.notifications = 0;
|
|
1847
1846
|
doc.interactions = doc?.messages?.length || 0;
|
|
1848
1847
|
for (let msg of doc.messages) {
|
|
@@ -2692,23 +2691,24 @@ export const get_apps = async function (req, job_id, headers) {
|
|
|
2692
2691
|
///////////////
|
|
2693
2692
|
////// FROM - IN
|
|
2694
2693
|
let requests_from = { docs: [] };
|
|
2694
|
+
if (filter_type === 'pending') {
|
|
2695
|
+
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'] };
|
|
2696
|
+
const requests_from_res = await db_module.find_couch_query('xuda_team', from_opt);
|
|
2695
2697
|
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
for await (let e of requests_from_res.docs) {
|
|
2700
|
-
//account_info
|
|
2698
|
+
for await (let e of requests_from_res.docs) {
|
|
2699
|
+
//account_info
|
|
2701
2700
|
|
|
2702
|
-
|
|
2701
|
+
let doc = { ts: e.team_req_date, pending: true, properties: {}, studio_meta: { createdByUid: e.team_req_from_uid }, team_req_id: e._id };
|
|
2703
2702
|
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2703
|
+
if (e.team_req_from_uid) {
|
|
2704
|
+
// const account_info_ret = await account_module.get_account_name({ uid_query: e.team_req_from_uid });
|
|
2705
|
+
// if (account_info_ret.code < 0) {
|
|
2706
|
+
// continue; // throw new Error(`account ${contact_uid} not found`);
|
|
2707
|
+
// }
|
|
2709
2708
|
|
|
2710
|
-
|
|
2711
|
-
|
|
2709
|
+
// doc.account_info = account_info_ret.data;
|
|
2710
|
+
doc.user_contact = await account_module.get_user_card(uid, e.team_req_from_uid);
|
|
2711
|
+
}
|
|
2712
2712
|
}
|
|
2713
2713
|
|
|
2714
2714
|
//share_item_id
|