@xuda.io/ai_module 1.1.4958 → 1.1.4960

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 +7 -9
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -48,12 +48,10 @@ import UglifyJS from 'uglify-js';
48
48
 
49
49
  global._ = _;
50
50
 
51
- // const { get_xuda_couch } = await import(`${module_path}/db_module/index.mjs`);
52
-
53
51
  const _common = await import(path.join(process.env.XUDA_HOME, 'common', 'xuda_node_common.mjs'));
54
52
  const _utils = await import(path.join(process.env.XUDA_HOME, 'common', 'xuda-cpi-utils.mjs'));
55
53
 
56
- const { get_active_account_profile_info, get_user_card } = await import(path.join(process.env.XUDA_HOME, 'common', 'cache_cpi.mjs'));
54
+ const { get_active_account_profile_info, get_user_card, get_account_name, get_contact_info } = await import(path.join(process.env.XUDA_HOME, 'common', 'cache_cpi.mjs'));
57
55
 
58
56
  const { createDoc, valid_menuType } = await import(`${runtime_modules_path}/xuda-studio-doc-utils.mjs`);
59
57
  const { xudaPrase } = await import(`${runtime_modules_path}/xuda-cli-plugin-html-parser-module.esm.mjs`);
@@ -1836,7 +1834,7 @@ export const get_ai_agent_info = async function (uid, job_id, headers, doc, from
1836
1834
 
1837
1835
  if (!from_marketplace) {
1838
1836
  if (doc?.reference_doc?.studio_meta?.shared_from_uid) {
1839
- const shared_from_uid_ret = await account_ms.get_account_name({ uid_query: doc.reference_doc.studio_meta.shared_from_uid });
1837
+ const shared_from_uid_ret = await get_account_name({ uid_query: doc.reference_doc.studio_meta.shared_from_uid });
1840
1838
  doc.icon_pattern = shared_from_uid_ret.data.profile_avatar;
1841
1839
  }
1842
1840
  }
@@ -3426,7 +3424,7 @@ export const create_conversation = async function (req, job_id, headers) {
3426
3424
  if (conversation_doc.reference_type === 'contacts' && conversation_type === 'chat') {
3427
3425
  // reference_id is the contact id
3428
3426
  contact_id = reference_id;
3429
- contact_doc = await account_ms.get_contact_info(uid, null, contact_id);
3427
+ contact_doc = await get_contact_info(uid, null, contact_id);
3430
3428
 
3431
3429
  if (!contact_doc?.contact_uid) {
3432
3430
  throw new Error('chat conversation to non user recipient is not allowed');
@@ -3672,11 +3670,11 @@ const contact_chat_conversation = async function (req, job_id, headers) {
3672
3670
 
3673
3671
  const conversation_id = conversation_doc._id;
3674
3672
 
3675
- const receiver_contact_doc = await account_ms.get_contact_info(uid, null, conversation_doc.reference_id);
3673
+ const receiver_contact_doc = await get_contact_info(uid, null, conversation_doc.reference_id);
3676
3674
  const receiver_app_id = await account_ms.get_account_default_project_id(receiver_contact_doc.contact_uid);
3677
3675
  let receiver_conversation_doc = await db_module.get_app_couch_doc_native(receiver_app_id, conversation_id);
3678
3676
 
3679
- const sender_contact_doc = await account_ms.get_contact_info(uid, null, conversation_doc.reference_id);
3677
+ const sender_contact_doc = await get_contact_info(uid, null, conversation_doc.reference_id);
3680
3678
  const sender_app_id = account_profile_info.app_id;
3681
3679
  let sender_conversation_doc = await db_module.get_app_couch_doc_native(sender_app_id, conversation_id);
3682
3680
 
@@ -3811,7 +3809,7 @@ const chat_email = async function (req, job_id, headers) {
3811
3809
  throw new Error('not an contact conversation');
3812
3810
  }
3813
3811
  const contact_id = sender_conversation_doc.reference_id;
3814
- const contact_info = await account_ms.get_contact_info(uid, null, contact_id);
3812
+ const contact_info = await get_contact_info(uid, null, contact_id);
3815
3813
  if (!contact_info.email) {
3816
3814
  throw new Error('empty contact email');
3817
3815
  }
@@ -3998,7 +3996,7 @@ const ai_chat_conversation = async function (req, job_id, headers) {
3998
3996
  const app_id = await account_ms.get_account_default_project_id(uid);
3999
3997
  const app_obj = await get_app_obj(account_profile_info.app_id);
4000
3998
  const userName = await account_ms.get_user_name(uid);
4001
- const account_info = (await account_ms.get_account_name({ uid })).data;
3999
+ const account_info = (await get_account_name({ uid })).data;
4002
4000
  let context = { ...{ app_id: account_profile_info.app_id, uid, userName, account_info, app_obj, account_id: uid }, ...extractClientInfo(headers) };
4003
4001
  const d = new Intl.DateTimeFormat('en-US').format(new Date());
4004
4002
  if (!visitors[d]) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.4958",
3
+ "version": "1.1.4960",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",