@xuda.io/ai_module 1.1.4201 → 1.1.4203

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 +14 -3
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -4384,12 +4384,23 @@ const update_conversation_mood_level = async function (conversation_id, prompt,
4384
4384
  await db_module.save_app_couch_doc_native(receiver_app_id, receiver_conversation_doc);
4385
4385
 
4386
4386
  if (update_contact) {
4387
- const receiver_contact_ret = await db_module.get_couch_view_raw('xuda_contacts', 'contacts_by_contact_uid', { key: [sender_uid, receiver_uid] });
4387
+ // const receiver_contact_ret = await db_module.get_couch_view_raw('xuda_contacts', 'contacts_by_contact_uid', { key: [sender_uid, receiver_uid] });
4388
4388
 
4389
- if (!receiver_contact_ret?.rows?.length) {
4389
+ const opt = {
4390
+ selector: {
4391
+ docType: 'contact',
4392
+ stat: 3,
4393
+ contact_uid: receiver_uid,
4394
+ },
4395
+ limit: 1,
4396
+ fields: ['_id'],
4397
+ };
4398
+ const receiver_contact_ret = await account_module.find_contact_query(sender_uid, opt);
4399
+
4400
+ if (!receiver_contact_ret?.docs?.length) {
4390
4401
  throw new Error('receiver contact id not found');
4391
4402
  }
4392
- const receiver_contact_id = receiver_contact_ret?.rows[0].id;
4403
+ const receiver_contact_id = receiver_contact_ret?.docs[0]._id;
4393
4404
  let receiver_contact_doc = await account_module.get_contact(receiver_uid, receiver_contact_id);
4394
4405
  receiver_contact_doc.contact_mood_level = mood_level_obj.mood_level;
4395
4406
  receiver_contact_doc.ts = Date.now();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.4201",
3
+ "version": "1.1.4203",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",