@xuda.io/ai_module 1.1.3870 → 1.1.3872

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 +15 -14
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -4068,24 +4068,25 @@ export const create_conversation = async function (req, job_id, headers) {
4068
4068
  await db_module.save_app_couch_doc_native(app_id, conversation_doc);
4069
4069
 
4070
4070
  await update_thumbnail('conversation', conversation_doc, app_id, uid, job_id, headers);
4071
+ if (conversation_doc.reference_type === 'contacts') {
4072
+ if (contact_uid_chat_conversation) {
4073
+ // write conversation to host after thumbnail update
4074
+ // get sender conversation
4071
4075
 
4072
- if (contact_uid_chat_conversation) {
4073
- // write conversation to host after thumbnail update
4074
- // get sender conversation
4076
+ const sender_conversation_doc = await db_module.get_app_couch_doc_native(app_id, conversation_obj.id);
4077
+ const receiver_app_id = await account_module.get_account_default_project_id(contact_uid_chat_conversation);
4075
4078
 
4076
- const sender_conversation_doc = await db_module.get_app_couch_doc_native(app_id, conversation_obj.id);
4077
- const receiver_app_id = await account_module.get_account_default_project_id(contact_uid_chat_conversation);
4079
+ let receiver_conversation_doc = await db_module.get_app_couch_doc_native(receiver_app_id, conversation_obj.id);
4080
+ receiver_conversation_doc.title = sender_conversation_doc.title;
4078
4081
 
4079
- let receiver_conversation_doc = await db_module.get_app_couch_doc_native(receiver_app_id, conversation_obj.id);
4080
- receiver_conversation_doc.title = sender_conversation_doc.title;
4082
+ receiver_conversation_doc.thumbnail_request_ts = sender_conversation_doc.thumbnail_request_ts;
4083
+ receiver_conversation_doc.chat_image = sender_conversation_doc.chat_image;
4084
+ await db_module.save_app_couch_doc_native(receiver_app_id, receiver_conversation_doc);
4081
4085
 
4082
- receiver_conversation_doc.thumbnail_request_ts = sender_conversation_doc.thumbnail_request_ts;
4083
- receiver_conversation_doc.chat_image = sender_conversation_doc.chat_image;
4084
- await db_module.save_app_couch_doc_native(receiver_app_id, receiver_conversation_doc);
4085
-
4086
- await update_conversation_mood_level(conversation_obj.id, prompt, uid, contact_uid_chat_conversation, true);
4087
- } else {
4088
- await update_conversation_mood_level(conversation_obj.id, prompt, null, receiver_contact_doc.contact_uid, conversation_doc.reference_type === 'contacts');
4086
+ await update_conversation_mood_level(conversation_obj.id, prompt, uid, contact_uid_chat_conversation, true);
4087
+ } else {
4088
+ await update_conversation_mood_level(conversation_obj.id, prompt, null, receiver_contact_doc.contact_uid, conversation_doc.reference_type === 'contacts');
4089
+ }
4089
4090
  }
4090
4091
  }, 1000);
4091
4092
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.3870",
3
+ "version": "1.1.3872",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",