@xuda.io/ai_module 1.1.5548 → 1.1.5550
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 +28 -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) {
|
|
@@ -4075,7 +4101,7 @@ const chat_email = async function (req, job_id, headers) {
|
|
|
4075
4101
|
}
|
|
4076
4102
|
|
|
4077
4103
|
if (conversation_doc.reference_type === 'contacts' && from_mailbox) {
|
|
4078
|
-
auto_response(uid, profile_id, conversation_id);
|
|
4104
|
+
auto_response(uid, profile_id, conversation_doc.reference_id, conversation_id);
|
|
4079
4105
|
}
|
|
4080
4106
|
|
|
4081
4107
|
return save_ret;
|
|
@@ -5151,7 +5177,7 @@ const add_conversation_item = async function (uid, profile_id, conversation_id,
|
|
|
5151
5177
|
}
|
|
5152
5178
|
};
|
|
5153
5179
|
|
|
5154
|
-
const auto_response = async function (uid, profile_id, conversation_id) {
|
|
5180
|
+
const auto_response = async function (uid, profile_id, contact_id, conversation_id) {
|
|
5155
5181
|
const account_profile_info = await get_active_account_profile_info(uid, profile_id);
|
|
5156
5182
|
|
|
5157
5183
|
const account_profile_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, profile_id);
|