@xuda.io/ai_module 1.1.4269 → 1.1.4271

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 +65 -64
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -4373,76 +4373,77 @@ const update_conversation_mood_level = async function (uid, target_contacts = []
4373
4373
  await db_module.save_app_couch_doc_native(account_profile_info.app_id, conversation_doc);
4374
4374
 
4375
4375
  if (update_contact) {
4376
- let contact_doc = await account_module.get_contact(target.uid, target.contact_id);
4376
+ const account_profile_info = await account_module.get_active_account_profile_info(target.uid);
4377
+ let contact_doc = await account_module.get_contact(account_profile_info.uid, target.contact_id);
4377
4378
  contact_doc.contact_mood_level = mood_level_obj.mood_level;
4378
4379
  contact_doc.ts = Date.now();
4379
4380
  await account_module.save_contact(target.uid, contact_doc);
4380
4381
  }
4381
4382
  }
4382
4383
 
4383
- //////// Sender
4384
- if (sender_uid) {
4385
- const sender_app_id = await account_module.get_account_default_project_id(sender_uid);
4386
-
4387
- let sender_conversation_doc = await db_module.get_app_couch_doc_native(sender_app_id, conversation_id);
4388
- sender_conversation_doc.mood_level = mood_level_obj.mood_level;
4389
- await db_module.save_app_couch_doc_native(sender_app_id, sender_conversation_doc);
4390
-
4391
- if (update_contact) {
4392
- // const sender_contact_ret = await db_module.get_couch_view_raw('xuda_contacts', 'contacts_by_contact_uid', { key: [receiver_uid, sender_uid] });
4393
-
4394
- const opt = {
4395
- selector: {
4396
- docType: 'contact',
4397
- stat: 3,
4398
- contact_uid: sender_uid,
4399
- },
4400
- limit: 1,
4401
- fields: ['_id'],
4402
- };
4403
- const sender_contact_ret = await account_module.find_contact_query(receiver_uid, opt);
4404
-
4405
- if (!sender_contact_ret?.docs?.length) {
4406
- throw new Error('sender contact id not found');
4407
- }
4408
- const sender_contact_id = sender_contact_ret?.docs[0]._id;
4409
- let sender_contact_doc = await account_module.get_contact(sender_uid, sender_contact_id);
4410
- sender_contact_doc.contact_mood_level = mood_level_obj.mood_level;
4411
- sender_contact_doc.ts = Date.now();
4412
- await account_module.save_contact(sender_uid, sender_contact_doc);
4413
- }
4414
- }
4415
- //////// Receiver
4416
-
4417
- const receiver_app_id = await account_module.get_account_default_project_id(receiver_uid);
4418
-
4419
- let receiver_conversation_doc = await db_module.get_app_couch_doc_native(receiver_app_id, conversation_id);
4420
- receiver_conversation_doc.mood_level = mood_level_obj.mood_level;
4421
- await db_module.save_app_couch_doc_native(receiver_app_id, receiver_conversation_doc);
4422
-
4423
- if (update_contact) {
4424
- // const receiver_contact_ret = await db_module.get_couch_view_raw('xuda_contacts', 'contacts_by_contact_uid', { key: [sender_uid, receiver_uid] });
4425
-
4426
- const opt = {
4427
- selector: {
4428
- docType: 'contact',
4429
- stat: 3,
4430
- contact_uid: receiver_uid,
4431
- },
4432
- limit: 1,
4433
- fields: ['_id'],
4434
- };
4435
- const receiver_contact_ret = await account_module.find_contact_query(sender_uid, opt);
4436
-
4437
- if (!receiver_contact_ret?.docs?.length) {
4438
- throw new Error('receiver contact id not found');
4439
- }
4440
- const receiver_contact_id = receiver_contact_ret?.docs[0]._id;
4441
- let receiver_contact_doc = await account_module.get_contact(receiver_uid, receiver_contact_id);
4442
- receiver_contact_doc.contact_mood_level = mood_level_obj.mood_level;
4443
- receiver_contact_doc.ts = Date.now();
4444
- await account_module.save_contact(receiver_uid, receiver_contact_doc);
4445
- }
4384
+ // //////// Sender
4385
+ // if (sender_uid) {
4386
+ // const sender_app_id = await account_module.get_account_default_project_id(sender_uid);
4387
+
4388
+ // let sender_conversation_doc = await db_module.get_app_couch_doc_native(sender_app_id, conversation_id);
4389
+ // sender_conversation_doc.mood_level = mood_level_obj.mood_level;
4390
+ // await db_module.save_app_couch_doc_native(sender_app_id, sender_conversation_doc);
4391
+
4392
+ // if (update_contact) {
4393
+ // // const sender_contact_ret = await db_module.get_couch_view_raw('xuda_contacts', 'contacts_by_contact_uid', { key: [receiver_uid, sender_uid] });
4394
+
4395
+ // const opt = {
4396
+ // selector: {
4397
+ // docType: 'contact',
4398
+ // stat: 3,
4399
+ // contact_uid: sender_uid,
4400
+ // },
4401
+ // limit: 1,
4402
+ // fields: ['_id'],
4403
+ // };
4404
+ // const sender_contact_ret = await account_module.find_contact_query(receiver_uid, opt);
4405
+
4406
+ // if (!sender_contact_ret?.docs?.length) {
4407
+ // throw new Error('sender contact id not found');
4408
+ // }
4409
+ // const sender_contact_id = sender_contact_ret?.docs[0]._id;
4410
+ // let sender_contact_doc = await account_module.get_contact(sender_uid, sender_contact_id);
4411
+ // sender_contact_doc.contact_mood_level = mood_level_obj.mood_level;
4412
+ // sender_contact_doc.ts = Date.now();
4413
+ // await account_module.save_contact(sender_uid, sender_contact_doc);
4414
+ // }
4415
+ // }
4416
+ // //////// Receiver
4417
+
4418
+ // const receiver_app_id = await account_module.get_account_default_project_id(receiver_uid);
4419
+
4420
+ // let receiver_conversation_doc = await db_module.get_app_couch_doc_native(receiver_app_id, conversation_id);
4421
+ // receiver_conversation_doc.mood_level = mood_level_obj.mood_level;
4422
+ // await db_module.save_app_couch_doc_native(receiver_app_id, receiver_conversation_doc);
4423
+
4424
+ // if (update_contact) {
4425
+ // // const receiver_contact_ret = await db_module.get_couch_view_raw('xuda_contacts', 'contacts_by_contact_uid', { key: [sender_uid, receiver_uid] });
4426
+
4427
+ // const opt = {
4428
+ // selector: {
4429
+ // docType: 'contact',
4430
+ // stat: 3,
4431
+ // contact_uid: receiver_uid,
4432
+ // },
4433
+ // limit: 1,
4434
+ // fields: ['_id'],
4435
+ // };
4436
+ // const receiver_contact_ret = await account_module.find_contact_query(sender_uid, opt);
4437
+
4438
+ // if (!receiver_contact_ret?.docs?.length) {
4439
+ // throw new Error('receiver contact id not found');
4440
+ // }
4441
+ // const receiver_contact_id = receiver_contact_ret?.docs[0]._id;
4442
+ // let receiver_contact_doc = await account_module.get_contact(receiver_uid, receiver_contact_id);
4443
+ // receiver_contact_doc.contact_mood_level = mood_level_obj.mood_level;
4444
+ // receiver_contact_doc.ts = Date.now();
4445
+ // await account_module.save_contact(receiver_uid, receiver_contact_doc);
4446
+ // }
4446
4447
  } catch (err) {
4447
4448
  debugger;
4448
4449
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.4269",
3
+ "version": "1.1.4271",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",