@xuda.io/account_module 1.2.1947 → 1.2.1948
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 +37 -36
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -2885,8 +2885,8 @@ export const generate_contact_avatar = async function (req, job_id, headers) {
|
|
|
2885
2885
|
};
|
|
2886
2886
|
|
|
2887
2887
|
export const deep_research_contact = async function (req, job_id, headers) {
|
|
2888
|
-
const email_module = await import(`${module_path}/email_module/index.mjs`);
|
|
2889
|
-
|
|
2888
|
+
// const email_module = await import(`${module_path}/email_module/index.mjs`);
|
|
2889
|
+
const ai_module = await import(`${module_path}/ai_module/index.mjs`);
|
|
2890
2890
|
|
|
2891
2891
|
const { contact_id, uid } = req;
|
|
2892
2892
|
const account_profile_info = await get_active_account_profile_info(uid);
|
|
@@ -2894,14 +2894,15 @@ export const deep_research_contact = async function (req, job_id, headers) {
|
|
|
2894
2894
|
var contact_doc = await get_contact(uid, contact_id);
|
|
2895
2895
|
contact_doc.is_spam = false;
|
|
2896
2896
|
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2897
|
+
if (contact_doc.account_type === 'business') {
|
|
2898
|
+
contact_doc.business_info = await ai_module.get_business_info(uid, '', contact_doc.email, account_profile_info);
|
|
2899
|
+
if (contact_doc.business_info.business_name !== 'Not available') {
|
|
2900
|
+
contact_doc.business_has_person = await ai_module.is_business_contact_has_person(uid, contact_doc.email, contact_doc.name, contact_doc?.metadata?.subject, contact_doc?.metadata?.summarized_body, account_profile_info);
|
|
2901
|
+
} else {
|
|
2902
|
+
contact_doc.account_type = 'personal';
|
|
2903
|
+
contact_doc.business_info = undefined;
|
|
2904
|
+
}
|
|
2905
|
+
}
|
|
2905
2906
|
|
|
2906
2907
|
const contact_save_ret = await save_contact(uid, contact_doc);
|
|
2907
2908
|
await delete_xuda_cache(contact_doc);
|
|
@@ -2909,35 +2910,35 @@ export const deep_research_contact = async function (req, job_id, headers) {
|
|
|
2909
2910
|
|
|
2910
2911
|
// find contact emails , set status to 1
|
|
2911
2912
|
|
|
2912
|
-
const emails = await db_module.find_app_couch_query(account_profile_info.app_id, {
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
});
|
|
2913
|
+
// const emails = await db_module.find_app_couch_query(account_profile_info.app_id, {
|
|
2914
|
+
// selector: {
|
|
2915
|
+
// docType: 'email',
|
|
2916
|
+
// contact_id,
|
|
2917
|
+
// stat: 3,
|
|
2918
|
+
// process_stat: 'partial',
|
|
2919
|
+
// },
|
|
2920
|
+
// });
|
|
2920
2921
|
|
|
2921
|
-
for await (let email of emails.docs) {
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2922
|
+
// for await (let email of emails.docs) {
|
|
2923
|
+
// const app_id = await get_account_default_project_id(uid);
|
|
2924
|
+
// if (email.conversation_id) {
|
|
2925
|
+
// db_module.delete_app_couch_doc(app_id, email.conversation_id);
|
|
2926
|
+
// email.conversation_id = null;
|
|
2927
|
+
// }
|
|
2928
|
+
// if (email.conversation_item_id) {
|
|
2929
|
+
// db_module.delete_app_couch_doc(app_id, email.conversation_item_id);
|
|
2930
|
+
// email.conversation_item_id = null;
|
|
2931
|
+
// }
|
|
2932
|
+
// const save_ret = await db_module.save_app_couch_doc_native(app_id, email);
|
|
2932
2933
|
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2934
|
+
// // save attachments
|
|
2935
|
+
// // summarized_body
|
|
2936
|
+
// req.uid = email.uid;
|
|
2937
|
+
// req.email_id = email._id;
|
|
2938
|
+
// await email_module.process_pending_email(req, job_id, headers);
|
|
2938
2939
|
|
|
2939
|
-
|
|
2940
|
-
}
|
|
2940
|
+
// // await process_email(email.email_account_id, profile, uid, email._id, job_id, headers, null, true);
|
|
2941
|
+
// }
|
|
2941
2942
|
|
|
2942
2943
|
// const conversations = await db_module.find_app_couch_query(account_profile_info.app_id, {
|
|
2943
2944
|
// selector: {
|