@xuda.io/account_module 1.2.1946 → 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.
Files changed (2) hide show
  1. package/index.mjs +38 -38
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -2070,7 +2070,7 @@ setTimeout(async () => {
2070
2070
  let ret;
2071
2071
 
2072
2072
  // ret = await generate_contact_avatar({ uid, contact_id: 'cnt_c07049718613a11d164e90450d5f2742' });
2073
- ret = await not_spam_contact({ uid, contact_id: 'cnt_c07049718613a11d164e90450d5f2742' });
2073
+ // ret = await not_spam_contact({ uid, contact_id: 'cnt_c07049718613a11d164e90450d5f2742' });
2074
2074
  // ret = await get_account_ai_usage({ uid });
2075
2075
  // ret = await create_account_profile({ uid });
2076
2076
  // ret = await get_account_profiles({ uid });
@@ -2759,7 +2759,6 @@ export const not_spam_contact = async function (req, job_id, headers) {
2759
2759
  const { contact_id, uid } = req;
2760
2760
  const account_profile_info = await get_active_account_profile_info(uid);
2761
2761
  try {
2762
- debugger;
2763
2762
  var contact_doc = await get_contact(uid, contact_id);
2764
2763
  contact_doc.is_spam = false;
2765
2764
 
@@ -2886,8 +2885,8 @@ export const generate_contact_avatar = async function (req, job_id, headers) {
2886
2885
  };
2887
2886
 
2888
2887
  export const deep_research_contact = async function (req, job_id, headers) {
2889
- const email_module = await import(`${module_path}/email_module/index.mjs`);
2890
- // const ai_module = await import(`${module_path}/ai_module/index.mjs`);
2888
+ // const email_module = await import(`${module_path}/email_module/index.mjs`);
2889
+ const ai_module = await import(`${module_path}/ai_module/index.mjs`);
2891
2890
 
2892
2891
  const { contact_id, uid } = req;
2893
2892
  const account_profile_info = await get_active_account_profile_info(uid);
@@ -2895,14 +2894,15 @@ export const deep_research_contact = async function (req, job_id, headers) {
2895
2894
  var contact_doc = await get_contact(uid, contact_id);
2896
2895
  contact_doc.is_spam = false;
2897
2896
 
2898
- await db_module.save_couch_doc_native('xuda_accounts', {
2899
- _id: await _common.xuda_get_uuid('spam_whitelist'),
2900
- uid,
2901
- docType: 'spam_whitelist',
2902
- email: contact_doc.email,
2903
- date_created_ts: Date.now(),
2904
- stat: 3,
2905
- });
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
+ }
2906
2906
 
2907
2907
  const contact_save_ret = await save_contact(uid, contact_doc);
2908
2908
  await delete_xuda_cache(contact_doc);
@@ -2910,35 +2910,35 @@ export const deep_research_contact = async function (req, job_id, headers) {
2910
2910
 
2911
2911
  // find contact emails , set status to 1
2912
2912
 
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
- });
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
+ // });
2921
2921
 
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);
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);
2933
2933
 
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);
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);
2939
2939
 
2940
- // await process_email(email.email_account_id, profile, uid, email._id, job_id, headers, null, true);
2941
- }
2940
+ // // await process_email(email.email_account_id, profile, uid, email._id, job_id, headers, null, true);
2941
+ // }
2942
2942
 
2943
2943
  // const conversations = await db_module.find_app_couch_query(account_profile_info.app_id, {
2944
2944
  // selector: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/account_module",
3
- "version": "1.2.1946",
3
+ "version": "1.2.1948",
4
4
  "description": "Xuda Account Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {