@xuda.io/ai_module 1.1.4220 → 1.1.4222

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 +10 -15
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -2817,8 +2817,8 @@ export const update_ai_agent = async function (req, job_id, headers) {
2817
2817
  // };
2818
2818
 
2819
2819
  export const get_apps = async function (req, job_id, headers) {
2820
- let { uid, _id, search, filter_type = 'all', limit, skip, mini_app_id } = req;
2821
-
2820
+ let { uid, _id, search, filter_type = 'all', limit, skip, mini_app_id, profile_id } = req;
2821
+ const account_profile_info = await account_module.get_active_account_profile_info(uid, profile_id);
2822
2822
  try {
2823
2823
  if (_id) return await get_studio_doc({ _id, uid });
2824
2824
  ///////////////
@@ -2833,6 +2833,10 @@ export const get_apps = async function (req, job_id, headers) {
2833
2833
  sort: [{ ts: 'desc' }],
2834
2834
  };
2835
2835
 
2836
+ if (!account_profile_info.is_main) {
2837
+ opt.selector['studio_meta.account_profiles'] = { $in: [account_profile_info.account_profile_id] };
2838
+ }
2839
+
2836
2840
  switch (filter_type) {
2837
2841
  case 'archived': {
2838
2842
  opt.selector.stat = 5;
@@ -2881,8 +2885,8 @@ export const get_apps = async function (req, job_id, headers) {
2881
2885
  opt.selector._id = mini_app_id;
2882
2886
  }
2883
2887
  //////////////
2884
- const account_profile_info = await account_module.get_active_account_profile_info(uid);
2885
- const app_id = await account_module.get_account_default_project_id(uid);
2888
+
2889
+ // const app_id = await account_module.get_account_default_project_id(uid);
2886
2890
 
2887
2891
  let user_apps = { docs: [], total_docs: 0 };
2888
2892
  if (filter_type !== 'pending') {
@@ -4447,16 +4451,8 @@ const chat_note = async function (req, job_id, headers) {
4447
4451
  const { uid } = req;
4448
4452
  const account_profile_info = await account_module.get_active_account_profile_info(uid);
4449
4453
  let { prompt, conversation_doc, attachments = [], ai_agents } = req;
4450
- // const { account_profile_info } = conversation_doc;
4451
- const conversation_id = conversation_doc._id;
4452
4454
 
4453
- // const receiver_contact_doc = await account_module.get_contact_info(uid, null, conversation_doc.reference_id);
4454
- // const receiver_app_id = await account_module.get_account_default_project_id(receiver_contact_doc.contact_uid);
4455
- // let receiver_conversation_doc = await db_module.get_app_couch_doc_native(receiver_app_id, conversation_id);
4456
-
4457
- // let sender_contact_doc = await account_module.get_contact_info(uid, null, conversation_doc.reference_id);
4458
-
4459
- // account_module.ts_contact(conversation_doc.reference_id);
4455
+ const conversation_id = conversation_doc._id;
4460
4456
 
4461
4457
  const sender_app_id = account_profile_info.app_id; //await account_module.get_account_default_project_id(uid);
4462
4458
  let sender_conversation_doc = await db_module.get_app_couch_doc_native(sender_app_id, conversation_id);
@@ -4474,8 +4470,7 @@ const chat_note = async function (req, job_id, headers) {
4474
4470
  });
4475
4471
 
4476
4472
  const obj = { id: item.data[0].id, ts: Date.now(), uid, read: true, conversation_type: 'note' };
4477
- // receiver_conversation_doc.messages.push(obj);
4478
- // await db_module.save_app_couch_doc_native(receiver_app_id, receiver_conversation_doc);
4473
+
4479
4474
  sender_conversation_doc.messages.push({ ...obj, ...{ read: false } });
4480
4475
  await db_module.save_app_couch_doc_native(sender_app_id, sender_conversation_doc);
4481
4476
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.4220",
3
+ "version": "1.1.4222",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",