@xuda.io/ai_module 1.1.5547 → 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.
- package/index.mjs +39 -0
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1221,6 +1221,19 @@ export const get_ai_chats = async function (req, job_id, headers) {
|
|
|
1221
1221
|
|
|
1222
1222
|
if (!account_profile_info.is_main) {
|
|
1223
1223
|
opt.selector.account_profiles = { $in: [account_profile_info.account_profile_id] };
|
|
1224
|
+
} else {
|
|
1225
|
+
const active_profiles = await db_module.find_app_couch_query(account_profile_info.app_id, {
|
|
1226
|
+
selector: {
|
|
1227
|
+
docType: 'account_profile',
|
|
1228
|
+
uid: account_profile_info.uid,
|
|
1229
|
+
stat: { $lt: 4 },
|
|
1230
|
+
},
|
|
1231
|
+
fields: ['_id'],
|
|
1232
|
+
limit: 9999,
|
|
1233
|
+
});
|
|
1234
|
+
|
|
1235
|
+
const active_profile_ids = active_profiles.docs.map((profile) => profile._id).filter(Boolean);
|
|
1236
|
+
opt.selector.account_profiles = { $in: active_profile_ids.length ? active_profile_ids : [account_profile_info.account_profile_id] };
|
|
1224
1237
|
}
|
|
1225
1238
|
|
|
1226
1239
|
switch (filter_type) {
|
|
@@ -2023,6 +2036,19 @@ export const get_ai_agents = async function (req, job_id, headers) {
|
|
|
2023
2036
|
|
|
2024
2037
|
if (!account_profile_info.is_main) {
|
|
2025
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] };
|
|
2026
2052
|
}
|
|
2027
2053
|
|
|
2028
2054
|
switch (filter_type) {
|
|
@@ -2407,6 +2433,19 @@ export const get_apps = async function (req, job_id, headers) {
|
|
|
2407
2433
|
|
|
2408
2434
|
if (!account_profile_info.is_main) {
|
|
2409
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] };
|
|
2410
2449
|
}
|
|
2411
2450
|
|
|
2412
2451
|
switch (filter_type) {
|