@xuda.io/ai_module 1.1.3799 → 1.1.3801

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 -6
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -4129,14 +4129,15 @@ export const submit_chat_conversation = async function (req, job_id, headers) {
4129
4129
  const app_id = await account_module.get_account_default_project_id(uid);
4130
4130
  let conversation_doc = await db_module.get_app_couch_doc_native(app_id, conversation_id);
4131
4131
  req.conversation_doc = conversation_doc;
4132
- if (conversation_doc.conversation_type === 'note') {
4133
- return await chat_note(req, job_id, header);
4134
- } else {
4135
- if (conversation_doc.reference_type === 'contacts') {
4136
- return await contact_chat_conversation(req, job_id, headers);
4132
+
4133
+ if (conversation_doc.reference_type === 'contacts') {
4134
+ if (conversation_doc.conversation_type === 'note') {
4135
+ return await chat_note(req, job_id, headers);
4137
4136
  } else {
4138
- return await ai_chat_conversation(req, job_id, headers);
4137
+ return await contact_chat_conversation(req, job_id, headers);
4139
4138
  }
4139
+ } else {
4140
+ return await ai_chat_conversation(req, job_id, headers);
4140
4141
  }
4141
4142
  } catch (err) {
4142
4143
  return { code: -14, data: err.message || String(err) };
@@ -4243,6 +4244,14 @@ const chat_note = async function (req, job_id, headers) {
4243
4244
 
4244
4245
  const conversation_id = conversation_doc._id;
4245
4246
 
4247
+ const receiver_contact_doc = await account_module.get_contact_info(uid, null, conversation_doc.reference_id);
4248
+ const receiver_app_id = await account_module.get_account_default_project_id(receiver_contact_doc.contact_uid);
4249
+ let receiver_conversation_doc = await db_module.get_app_couch_doc_native(receiver_app_id, conversation_id);
4250
+
4251
+ const sender_contact_doc = await account_module.get_contact_info(uid, null, conversation_doc.reference_id);
4252
+ const sender_app_id = await account_module.get_account_default_project_id(uid);
4253
+ let sender_conversation_doc = await db_module.get_app_couch_doc_native(sender_app_id, conversation_id);
4254
+
4246
4255
  const item = await client.conversations.items.create(conversation_id, {
4247
4256
  items: [
4248
4257
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.3799",
3
+ "version": "1.1.3801",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",