@xuda.io/ai_module 1.1.4268 → 1.1.4270
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.
- package/index.mjs +67 -67
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -4373,76 +4373,76 @@ 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, contact_id);
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
await account_module.save_contact(
|
|
4376
|
+
let contact_doc = await account_module.get_contact(target.uid, target.contact_id);
|
|
4377
|
+
contact_doc.contact_mood_level = mood_level_obj.mood_level;
|
|
4378
|
+
contact_doc.ts = Date.now();
|
|
4379
|
+
await account_module.save_contact(target.uid, contact_doc);
|
|
4380
4380
|
}
|
|
4381
4381
|
}
|
|
4382
4382
|
|
|
4383
|
-
//////// Sender
|
|
4384
|
-
if (sender_uid) {
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
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
|
-
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
}
|
|
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
|
+
// }
|
|
4446
4446
|
} catch (err) {
|
|
4447
4447
|
debugger;
|
|
4448
4448
|
}
|