@xuda.io/account_module 1.2.1772 → 1.2.1774
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 +10 -7
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -2098,7 +2098,7 @@ export const add_contact = async function (req, job_id, headers) {
|
|
|
2098
2098
|
/////////////////
|
|
2099
2099
|
|
|
2100
2100
|
let is_spam = false;
|
|
2101
|
-
let email_type_info;
|
|
2101
|
+
// let email_type_info;
|
|
2102
2102
|
let account_type_info;
|
|
2103
2103
|
let account_type;
|
|
2104
2104
|
let cached_contact;
|
|
@@ -2121,13 +2121,16 @@ export const add_contact = async function (req, job_id, headers) {
|
|
|
2121
2121
|
|
|
2122
2122
|
if (_.isEmpty(cached_contact)) {
|
|
2123
2123
|
if (metadata.subject && !metadata.is_sent) {
|
|
2124
|
-
email_type_info = await ai_module.detect_email_type(uid, name, email, account_profile_info, '', metadata?.subject);
|
|
2125
|
-
is_spam = email_type_info.email_type === 'spam' || email_type_info.email_type === 'promotional';
|
|
2126
|
-
|
|
2124
|
+
// email_type_info = await ai_module.detect_email_type(uid, name, email, account_profile_info, '', metadata?.subject);
|
|
2125
|
+
// is_spam = email_type_info.email_type === 'spam' || email_type_info.email_type === 'promotional';
|
|
2126
|
+
is_spam = await ai_module.is_spam_email(uid, email, metadata.subject, account_profile_info);
|
|
2127
2127
|
}
|
|
2128
2128
|
if (!is_spam) {
|
|
2129
|
-
account_type_info = await ai_module.analyze_email_account_type(uid, name, email, account_profile_info, metadata?.summarized_body);
|
|
2130
|
-
account_type = account_type_info.account_type;
|
|
2129
|
+
// account_type_info = await ai_module.analyze_email_account_type(uid, name, email, account_profile_info, metadata?.summarized_body);
|
|
2130
|
+
// account_type = account_type_info.account_type;
|
|
2131
|
+
|
|
2132
|
+
const is_business = await ai_module.is_business_contact(uid, email, name, metadata.subject, metadata.summarized_body, account_profile_info);
|
|
2133
|
+
account_type = is_business ? 'business' : 'personal';
|
|
2131
2134
|
|
|
2132
2135
|
if (_.isEmpty(cached_contact) && account_type === 'business' && !account_type_info.is_real_person) {
|
|
2133
2136
|
const domain = email.includes('@') ? email.split('@')[1] : '';
|
|
@@ -2162,7 +2165,7 @@ export const add_contact = async function (req, job_id, headers) {
|
|
|
2162
2165
|
account_profiles: [account_profile_obj._id],
|
|
2163
2166
|
account_type: cached_contact?.account_type || account_type,
|
|
2164
2167
|
account_type_info: cached_contact?.account_type_info || account_type_info,
|
|
2165
|
-
email_type_info: cached_contact?.email_type_info || email_type_info,
|
|
2168
|
+
// email_type_info: cached_contact?.email_type_info || email_type_info,
|
|
2166
2169
|
};
|
|
2167
2170
|
if (!_.isEmpty(cached_contact?.business_info)) {
|
|
2168
2171
|
contact_obj.business_info = _.cloneDeep(cached_contact.business_info);
|