@xuda.io/ai_module 1.1.5548 → 1.1.5549

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 +26 -0
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -2036,6 +2036,19 @@ export const get_ai_agents = async function (req, job_id, headers) {
2036
2036
 
2037
2037
  if (!account_profile_info.is_main) {
2038
2038
  opt.selector['studio_meta.account_profiles'] = { $in: [account_profile_info.account_profile_id] };
2039
+ } else {
2040
+ const active_profiles = await db_module.find_app_couch_query(account_profile_info.app_id, {
2041
+ selector: {
2042
+ docType: 'account_profile',
2043
+ uid: account_profile_info.uid,
2044
+ stat: { $lt: 4 },
2045
+ },
2046
+ fields: ['_id'],
2047
+ limit: 9999,
2048
+ });
2049
+
2050
+ const active_profile_ids = active_profiles.docs.map((profile) => profile._id).filter(Boolean);
2051
+ opt.selector.account_profiles = { $in: active_profile_ids.length ? active_profile_ids : [account_profile_info.account_profile_id] };
2039
2052
  }
2040
2053
 
2041
2054
  switch (filter_type) {
@@ -2420,6 +2433,19 @@ export const get_apps = async function (req, job_id, headers) {
2420
2433
 
2421
2434
  if (!account_profile_info.is_main) {
2422
2435
  opt.selector['studio_meta.account_profiles'] = { $in: [account_profile_info.account_profile_id] };
2436
+ } else {
2437
+ const active_profiles = await db_module.find_app_couch_query(account_profile_info.app_id, {
2438
+ selector: {
2439
+ docType: 'account_profile',
2440
+ uid: account_profile_info.uid,
2441
+ stat: { $lt: 4 },
2442
+ },
2443
+ fields: ['_id'],
2444
+ limit: 9999,
2445
+ });
2446
+
2447
+ const active_profile_ids = active_profiles.docs.map((profile) => profile._id).filter(Boolean);
2448
+ opt.selector.account_profiles = { $in: active_profile_ids.length ? active_profile_ids : [account_profile_info.account_profile_id] };
2423
2449
  }
2424
2450
 
2425
2451
  switch (filter_type) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.5548",
3
+ "version": "1.1.5549",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",