@xuda.io/ai_module 1.1.4261 → 1.1.4262

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 +6 -5
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -4181,6 +4181,7 @@ export const create_conversation = async function (req, job_id, headers) {
4181
4181
  // reference_id is the contact id
4182
4182
  receiver_contact_id = reference_id;
4183
4183
  receiver_contact_doc = await account_module.get_contact_info(uid, null, receiver_contact_id);
4184
+
4184
4185
  if (conversation_type === 'chat') {
4185
4186
  if (!receiver_contact_doc?.contact_uid) {
4186
4187
  throw new Error('chat conversation to non user recipient is not allowed');
@@ -4241,10 +4242,10 @@ export const create_conversation = async function (req, job_id, headers) {
4241
4242
  receiver_conversation_doc.chat_image = sender_conversation_doc.chat_image;
4242
4243
  await db_module.save_app_couch_doc_native(receiver_app_id, receiver_conversation_doc);
4243
4244
 
4244
- await update_conversation_mood_level(conversation_obj.id, prompt, uid, contact_uid_chat_conversation, true, account_profile_info);
4245
+ await update_conversation_mood_level(uid, conversation_obj.id, prompt, uid, contact_uid_chat_conversation, true, account_profile_info);
4245
4246
  } else {
4246
4247
  // other cases rather then chat
4247
- await update_conversation_mood_level(conversation_obj.id, prompt, null, receiver_contact_doc.contact_uid, conversation_doc.reference_type === 'contacts', account_profile_info);
4248
+ await update_conversation_mood_level(uid, conversation_obj.id, prompt, null, receiver_contact_doc.contact_uid, conversation_doc.reference_type === 'contacts', account_profile_info);
4248
4249
  }
4249
4250
  }
4250
4251
  }, 1000);
@@ -4337,11 +4338,11 @@ export const submit_chat_conversation = async function (req, job_id, headers) {
4337
4338
  }
4338
4339
  };
4339
4340
 
4340
- const update_conversation_mood_level = async function (conversation_id, prompt, sender_uid, receiver_uid, update_contact, account_profile_info) {
4341
+ const update_conversation_mood_level = async function (uid, conversation_id, prompt, sender_uid, receiver_uid, update_contact, account_profile_info) {
4341
4342
  try {
4342
4343
  // analyze the mood of the conversation
4343
4344
  const mood_level = await submit_chat_gpt_prompt({
4344
- uid: sender_uid,
4345
+ uid,
4345
4346
  prompt: `analyze the mood of the following prompt: ${prompt}. return -2: very negative,-1: negative 0:natural 1:positive 2: very positive.`,
4346
4347
  model: 'gpt-5-nano',
4347
4348
  response_format: z.object({
@@ -4453,7 +4454,7 @@ const contact_chat_conversation = async function (req, job_id, headers) {
4453
4454
  sender_conversation_doc.messages.push({ ...obj, ...{ read: false } });
4454
4455
  await db_module.save_app_couch_doc_native(sender_app_id, sender_conversation_doc);
4455
4456
 
4456
- update_conversation_mood_level(conversation_id, prompt, uid, receiver_contact_doc.contact_uid, conversation_doc.reference_type === 'contacts');
4457
+ update_conversation_mood_level(uid, conversation_id, prompt, uid, receiver_contact_doc.contact_uid, conversation_doc.reference_type === 'contacts');
4457
4458
 
4458
4459
  return { code: 15, data: item };
4459
4460
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.4261",
3
+ "version": "1.1.4262",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",