@xuda.io/ai_module 1.1.4933 → 1.1.4935
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 +10 -16
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1794,21 +1794,13 @@ export const get_ai_agent_info = async function (uid, job_id, headers, doc, from
|
|
|
1794
1794
|
return ret;
|
|
1795
1795
|
};
|
|
1796
1796
|
|
|
1797
|
-
const
|
|
1797
|
+
const agent_conversation_count = async function (agent_id) {
|
|
1798
1798
|
const counts_ret = await db_module.get_app_couch_view(account_profile_info.app_id, 'chat_conversation_item_counts', {
|
|
1799
1799
|
reduce: true,
|
|
1800
1800
|
group_level: 1,
|
|
1801
1801
|
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
return counts_ret?.rows?.[0]?.value || 0;
|
|
1806
|
-
};
|
|
1807
|
-
const chat_conversation_read = async function (contact_id, conversation_id) {
|
|
1808
|
-
const counts_ret = await db_module.get_app_couch_view(account_profile_info.app_id, 'chat_conversation_item_read', {
|
|
1809
|
-
reduce: true,
|
|
1810
|
-
group_level: 2,
|
|
1811
|
-
key: [uid, contact_id, conversation_id],
|
|
1802
|
+
startkey: [agent_id, ''],
|
|
1803
|
+
endkey: [agent_id, 'zzzzzz'],
|
|
1812
1804
|
});
|
|
1813
1805
|
|
|
1814
1806
|
return counts_ret?.rows?.[0]?.value || 0;
|
|
@@ -1826,12 +1818,14 @@ export const get_ai_agent_info = async function (uid, job_id, headers, doc, from
|
|
|
1826
1818
|
if (!from_marketplace) {
|
|
1827
1819
|
doc.interactions = 0;
|
|
1828
1820
|
doc.chats = 0;
|
|
1829
|
-
|
|
1821
|
+
debugger;
|
|
1822
|
+
const aa = await agent_conversation_count(doc._id);
|
|
1823
|
+
// const chats_ret = await get_ai_chats({ uid, reference_id: doc._id }, job_id, headers);
|
|
1830
1824
|
|
|
1831
|
-
for (let chat of chats_ret?.data?.docs || []) {
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
}
|
|
1825
|
+
// for (let chat of chats_ret?.data?.docs || []) {
|
|
1826
|
+
// doc.chats++;
|
|
1827
|
+
// if (chat.interactions) doc.interactions += chat.interactions;
|
|
1828
|
+
// }
|
|
1835
1829
|
}
|
|
1836
1830
|
doc.border = get_contact_border(doc);
|
|
1837
1831
|
doc.card_background = get_background(doc);
|