@xuda.io/ai_module 1.1.4932 → 1.1.4933

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.
Files changed (2) hide show
  1. package/index.mjs +21 -1
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -1794,6 +1794,26 @@ export const get_ai_agent_info = async function (uid, job_id, headers, doc, from
1794
1794
  return ret;
1795
1795
  };
1796
1796
 
1797
+ const chat_conversation_count = async function (contact_id, conversation_id) {
1798
+ const counts_ret = await db_module.get_app_couch_view(account_profile_info.app_id, 'chat_conversation_item_counts', {
1799
+ reduce: true,
1800
+ group_level: 1,
1801
+
1802
+ key: [contact_id, conversation_id],
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],
1812
+ });
1813
+
1814
+ return counts_ret?.rows?.[0]?.value || 0;
1815
+ };
1816
+
1797
1817
  delete doc.agentConfig;
1798
1818
 
1799
1819
  if (doc.stat === 1) {
@@ -1806,7 +1826,7 @@ export const get_ai_agent_info = async function (uid, job_id, headers, doc, from
1806
1826
  if (!from_marketplace) {
1807
1827
  doc.interactions = 0;
1808
1828
  doc.chats = 0;
1809
- const chats_ret = []; // = await get_ai_chats({ uid, reference_id: doc._id }, job_id, headers);
1829
+ const chats_ret = await get_ai_chats({ uid, reference_id: doc._id }, job_id, headers);
1810
1830
 
1811
1831
  for (let chat of chats_ret?.data?.docs || []) {
1812
1832
  doc.chats++;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.4932",
3
+ "version": "1.1.4933",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",