@xuda.io/ai_module 1.1.5085 → 1.1.5087

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 (3) hide show
  1. package/index.mjs +6 -27
  2. package/old.mjs +2 -2
  3. package/package.json +1 -1
package/index.mjs CHANGED
@@ -1173,13 +1173,10 @@ export const get_ai_chats = async function (req, job_id, headers) {
1173
1173
  reduce: true,
1174
1174
  group_level: 999,
1175
1175
 
1176
- // key: [contact_id, conversation_id],
1177
-
1178
1176
  startkey: [reference_id, ''],
1179
1177
  endkey: [reference_id, 'zzzzzz'],
1180
1178
  });
1181
1179
 
1182
- // return counts_ret?.rows?.[0]?.value || 0;
1183
1180
  let counts = {};
1184
1181
  for (const val of counts_ret?.rows) {
1185
1182
  counts[val.key[1]] = val.value;
@@ -1191,13 +1188,11 @@ export const get_ai_chats = async function (req, job_id, headers) {
1191
1188
  const counts_ret = await db_module.get_app_couch_view(account_profile_info.app_id, 'chat_conversation_item_read', {
1192
1189
  reduce: true,
1193
1190
  group_level: 999, //2,
1194
- // key: [uid, contact_id, conversation_id],
1195
1191
 
1196
1192
  startkey: [uid, reference_id, ''],
1197
1193
  endkey: [uid, reference_id, 'zzzzzz'],
1198
1194
  });
1199
1195
 
1200
- // return counts_ret?.rows?.[0]?.value || 0;
1201
1196
  let counts = {};
1202
1197
  for (const val of counts_ret?.rows) {
1203
1198
  counts[val.key[2]] = val.value;
@@ -1378,7 +1373,7 @@ export const get_ai_chats = async function (req, job_id, headers) {
1378
1373
  let doc = { date_created: e.team_req_date, pending: true, uid: e.team_req_from_uid, team_req_id: e._id };
1379
1374
 
1380
1375
  if (e.team_req_from_uid) {
1381
- doc.user_contact = await get_user_card(uid, e.team_req_from_uid);
1376
+ doc.user_contact = await get_user_card({ uid, uid_query: e.team_req_from_uid });
1382
1377
  }
1383
1378
 
1384
1379
  //share_item_id
@@ -1402,19 +1397,6 @@ export const get_ai_chats = async function (req, job_id, headers) {
1402
1397
  } else {
1403
1398
  ai_chats = await get_data_find();
1404
1399
  }
1405
-
1406
- // ai_chats = await db_module.find_app_couch_query(account_profile_info.app_id, opt);
1407
- // if (!limit || conversation_id) {
1408
- // ai_chats.total_docs = ai_chats.docs.length;
1409
- // } else {
1410
- // delete opt.sort;
1411
- // delete opt.skip;
1412
- // opt.limit = 9999;
1413
- // opt.fields = ['_id'];
1414
-
1415
- // const counter = await db_module.find_app_couch_query(account_profile_info.app_id, opt);
1416
- // ai_chats.total_docs = counter.docs.length;
1417
- // }
1418
1400
  }
1419
1401
 
1420
1402
  let docs = [];
@@ -1431,14 +1413,11 @@ export const get_ai_chats = async function (req, job_id, headers) {
1431
1413
  doc.reference_doc = reference_doc;
1432
1414
  }
1433
1415
 
1434
- // const contact_chat_conversation_count_ret = await chat_conversation_count(doc.reference_id, doc._id);
1435
- // const contact_chat_conversation_read_ret = await chat_conversation_read(doc.reference_id, doc._id);
1436
-
1437
1416
  doc.interactions = contact_chat_conversation_count_ret[doc._id];
1438
1417
  doc.notifications = contact_chat_conversation_count_ret[doc._id] - contact_chat_conversation_read_ret[doc._id];
1439
1418
  doc.chats = doc.interactions;
1440
1419
 
1441
- doc.user_contact = await get_user_card(uid, doc.uid);
1420
+ doc.user_contact = await get_user_card({ uid, uid_query: doc.uid });
1442
1421
 
1443
1422
  doc.privilege = doc.uid === uid || doc?.account_profile_info?.uid === uid;
1444
1423
 
@@ -1914,7 +1893,7 @@ export const get_ai_agent_info = async function (uid, job_id, headers, doc, from
1914
1893
  }
1915
1894
 
1916
1895
  if (doc?.studio_meta?.createdByUid) {
1917
- doc.user_contact = await get_user_card(uid, doc.studio_meta.createdByUid);
1896
+ doc.user_contact = await get_user_card({ uid, uid_query: doc.studio_meta.createdByUid });
1918
1897
  }
1919
1898
  if (!from_marketplace) {
1920
1899
  doc.interactions = 0;
@@ -2065,7 +2044,7 @@ export const get_ai_agents = async function (req, job_id, headers) {
2065
2044
  let doc = { ts: e.team_req_date, pending: true, properties: {}, studio_meta: { createdByUid: e.team_req_from_uid }, team_req_id: e._id };
2066
2045
 
2067
2046
  if (e.team_req_from_uid) {
2068
- doc.user_contact = await get_user_card(uid, e.team_req_from_uid);
2047
+ doc.user_contact = await get_user_card({ uid, uid_query: e.team_req_from_uid });
2069
2048
  doc.icon_pattern = doc.user_contact.profile_avatar;
2070
2049
  }
2071
2050
 
@@ -2443,7 +2422,7 @@ export const get_apps = async function (req, job_id, headers) {
2443
2422
  let doc = { ts: e.team_req_date, pending: true, properties: {}, studio_meta: { createdByUid: e.team_req_from_uid }, team_req_id: e._id };
2444
2423
 
2445
2424
  if (e.team_req_from_uid) {
2446
- doc.user_contact = await get_user_card(uid, e.team_req_from_uid);
2425
+ doc.user_contact = await get_user_card({ uid, uid_query: e.team_req_from_uid });
2447
2426
  }
2448
2427
 
2449
2428
  //share_item_id
@@ -2468,7 +2447,7 @@ export const get_apps = async function (req, job_id, headers) {
2468
2447
  doc.reference_doc = reference_doc;
2469
2448
  }
2470
2449
 
2471
- doc.user_contact = await get_user_card(uid, doc.studio_meta.createdByUid);
2450
+ doc.user_contact = await get_user_card({ uid, uid_query: doc.studio_meta.createdByUid });
2472
2451
 
2473
2452
  doc.privilege = doc.studio_meta.createdByUid === uid || doc?.studio_meta?.account_profile_info?.uid === uid;
2474
2453
 
package/old.mjs CHANGED
@@ -1786,7 +1786,7 @@ export const get_apps = async function (req, job_id, headers) {
1786
1786
  let doc = { ts: e.team_req_date, pending: true, properties: {}, studio_meta: { createdByUid: e.team_req_from_uid }, team_req_id: e._id };
1787
1787
 
1788
1788
  if (e.team_req_from_uid) {
1789
- doc.user_contact = await account_module.get_user_card(uid, e.team_req_from_uid);
1789
+ doc.user_contact = await account_module.get_user_card({ uid, uid_query: e.team_req_from_uid });
1790
1790
  }
1791
1791
 
1792
1792
  //share_item_id
@@ -1811,7 +1811,7 @@ export const get_apps = async function (req, job_id, headers) {
1811
1811
  doc.reference_doc = reference_doc;
1812
1812
  }
1813
1813
 
1814
- doc.user_contact = await account_module.get_user_card(uid, doc.studio_meta.createdByUid);
1814
+ doc.user_contact = await account_module.get_user_card({ uid, uid_query: doc.studio_meta.createdByUid });
1815
1815
 
1816
1816
  docs.push(doc);
1817
1817
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.5085",
3
+ "version": "1.1.5087",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",