@xuda.io/ai_module 1.1.4198 → 1.1.4200

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 +14 -3
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -4199,10 +4199,10 @@ export const create_conversation = async function (req, job_id, headers) {
4199
4199
  };
4200
4200
  const sender_contact_ret = await account_module.find_contact_query(receiver_contact_doc.contact_uid, opt);
4201
4201
 
4202
- if (!sender_contact_ret?.rows?.length) {
4202
+ if (!sender_contact_ret?.docs?.length) {
4203
4203
  throw new Error('sender contact id not found');
4204
4204
  }
4205
- const sender_contact_id = sender_contact_ret?.rows[0].id;
4205
+ const sender_contact_id = sender_contact_ret?.docs[0]._id;
4206
4206
 
4207
4207
  const app_id = await account_module.get_account_default_project_id(receiver_contact_doc.contact_uid);
4208
4208
  const save_ret = await db_module.save_app_couch_doc(app_id, { ...conversation_doc, ...{ uid: receiver_contact_doc.contact_uid, reference_id: sender_contact_id } });
@@ -4352,7 +4352,18 @@ const update_conversation_mood_level = async function (conversation_id, prompt,
4352
4352
  await db_module.save_app_couch_doc_native(sender_app_id, sender_conversation_doc);
4353
4353
 
4354
4354
  if (update_contact) {
4355
- const sender_contact_ret = await db_module.get_couch_view_raw('xuda_contacts', 'contacts_by_contact_uid', { key: [receiver_uid, sender_uid] });
4355
+ // const sender_contact_ret = await db_module.get_couch_view_raw('xuda_contacts', 'contacts_by_contact_uid', { key: [receiver_uid, sender_uid] });
4356
+
4357
+ const opt = {
4358
+ selector: {
4359
+ docType: 'contact',
4360
+ stat: 3,
4361
+ contact_uid: sender_uid,
4362
+ },
4363
+ limit: 1,
4364
+ fields: ['_id'],
4365
+ };
4366
+ const sender_contact_ret = await account_module.find_contact_query(receiver_uid, opt);
4356
4367
 
4357
4368
  if (!sender_contact_ret?.rows?.length) {
4358
4369
  throw new Error('sender contact id not found');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.4198",
3
+ "version": "1.1.4200",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",