@xuda.io/ai_module 1.1.5050 → 1.1.5052

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 +20 -16
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -1370,9 +1370,12 @@ export const get_ai_chats = async function (req, job_id, headers) {
1370
1370
  let ai_chats = { docs: [], total_docs: 0 };
1371
1371
 
1372
1372
  if (filter_type !== 'pending') {
1373
- let aa = await get_data_view();
1374
- debugger;
1375
- ai_chats = await get_data_find();
1373
+ if (reference_id) {
1374
+ ai_chats = await get_data_view();
1375
+ debugger;
1376
+ } else {
1377
+ ai_chats = await get_data_find();
1378
+ }
1376
1379
 
1377
1380
  // ai_chats = await db_module.find_app_couch_query(account_profile_info.app_id, opt);
1378
1381
  // if (!limit || conversation_id) {
@@ -1406,19 +1409,20 @@ export const get_ai_chats = async function (req, job_id, headers) {
1406
1409
  doc.notifications = contact_chat_conversation_count_ret - contact_chat_conversation_read_ret;
1407
1410
  doc.chats = doc.interactions;
1408
1411
 
1409
- // get conversation item
1410
- let opt = {
1411
- selector: {
1412
- docType: 'chat_conversation_item',
1413
- conversation_id: doc._id,
1414
- },
1415
- limit: 1,
1416
- };
1417
- const conversation_item_ret = await db_module.find_app_couch_query(account_profile_info.app_id, opt);
1418
- doc.conversation_item = conversation_item_ret?.docs?.[0];
1419
- if (doc?.conversation_item?.email_id) {
1420
- doc.email_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, doc.conversation_item.email_id);
1421
- }
1412
+ // // get conversation item
1413
+ // let opt = {
1414
+ // selector: {
1415
+ // docType: 'chat_conversation_item',
1416
+ // conversation_id: doc._id,
1417
+ // },
1418
+ // limit: 1,
1419
+ // };
1420
+ // const conversation_item_ret = await db_module.find_app_couch_query(account_profile_info.app_id, opt);
1421
+ // doc.conversation_item = conversation_item_ret?.docs?.[0];
1422
+ // if (doc?.conversation_item?.email_id) {
1423
+ // doc.email_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, doc.conversation_item.email_id);
1424
+ // }
1425
+
1422
1426
  // doc.notifications = 0;
1423
1427
  // doc.interactions = doc?.messages?.length || 0;
1424
1428
  // for (let msg of doc.messages) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.5050",
3
+ "version": "1.1.5052",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",