@xuda.io/ai_module 1.1.3609 → 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 +16 -17
- 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) {
|