@xuda.io/account_module 1.2.1979 → 1.2.1982
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 +17 -33
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -2888,7 +2888,6 @@ export const generate_contact_avatar = async function (req, job_id, headers) {
|
|
|
2888
2888
|
};
|
|
2889
2889
|
|
|
2890
2890
|
export const set_deep_research_contact = async function (req, job_id, headers) {
|
|
2891
|
-
// const email_module = await import(`${module_path}/email_module/index.mjs`);
|
|
2892
2891
|
const ai_module = await import(`${module_path}/ai_module/index.mjs`);
|
|
2893
2892
|
|
|
2894
2893
|
const { contact_id, uid } = req;
|
|
@@ -2897,22 +2896,22 @@ export const set_deep_research_contact = async function (req, job_id, headers) {
|
|
|
2897
2896
|
var contact_doc = await get_contact(uid, contact_id);
|
|
2898
2897
|
contact_doc.deep_research = true;
|
|
2899
2898
|
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2899
|
+
if (contact_doc.account_type === 'business') {
|
|
2900
|
+
contact_doc.business_info = await ai_module.get_business_info(uid, '', contact_doc.email, account_profile_info);
|
|
2901
|
+
if (contact_doc.business_info.business_name !== 'Not available') {
|
|
2902
|
+
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);
|
|
2903
|
+
} else {
|
|
2904
|
+
contact_doc.account_type = 'personal';
|
|
2905
|
+
contact_doc.business_info = undefined;
|
|
2906
|
+
}
|
|
2907
|
+
}
|
|
2909
2908
|
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2909
|
+
if (contact_doc.account_type === 'personal' || contact_doc?.business_has_person) {
|
|
2910
|
+
contact_doc.person_info = await ai_module.get_person_info(uid, contact_doc.name, contact_doc.email, account_profile_info, contact_doc?.metadata?.summarized_body);
|
|
2911
|
+
if (!contact_doc.name) {
|
|
2912
|
+
contact_doc.name = await ai_module.get_name_from_email_addr(uid, contact_doc.email, account_profile_info);
|
|
2913
|
+
}
|
|
2914
|
+
}
|
|
2916
2915
|
|
|
2917
2916
|
const contact_save_ret = await save_contact(uid, contact_doc);
|
|
2918
2917
|
await delete_xuda_cache(contact_doc);
|
|
@@ -2925,7 +2924,7 @@ export const set_deep_research_contact = async function (req, job_id, headers) {
|
|
|
2925
2924
|
process_stat: 'partial',
|
|
2926
2925
|
},
|
|
2927
2926
|
});
|
|
2928
|
-
|
|
2927
|
+
|
|
2929
2928
|
for await (let conversation_item of conversation_items.docs) {
|
|
2930
2929
|
try {
|
|
2931
2930
|
const account_profile_info = await get_active_account_profile_info(conversation_item.uid);
|
|
@@ -2933,25 +2932,10 @@ export const set_deep_research_contact = async function (req, job_id, headers) {
|
|
|
2933
2932
|
|
|
2934
2933
|
const transcript = await ai_module.get_transcript(conversation_item.uid, conversation_item.app_id, conversation_item.conversation_id, account_profile_info, conversation_item.file.filename);
|
|
2935
2934
|
let items;
|
|
2936
|
-
|
|
2935
|
+
|
|
2937
2936
|
if (transcript) {
|
|
2938
2937
|
items = await ai_module.add_transcript_conversation_item(conversation_doc.reference_conversation_id, conversation_item.file.filename, transcript);
|
|
2939
2938
|
|
|
2940
|
-
// try {
|
|
2941
|
-
// items = await client.conversations.items.create(conversation_doc.reference_conversation_id, {
|
|
2942
|
-
// items: [
|
|
2943
|
-
// {
|
|
2944
|
-
// type: 'message',
|
|
2945
|
-
// role: 'system',
|
|
2946
|
-
// content: [{ type: 'input_text', text: `the user attached file name: ${conversation_item.file.filename} with content: ${transcript?.data || transcript || ''}` }],
|
|
2947
|
-
// },
|
|
2948
|
-
// ],
|
|
2949
|
-
// });
|
|
2950
|
-
// // report_ai_status('conversations');
|
|
2951
|
-
// } catch (err) {
|
|
2952
|
-
// // report_ai_status('conversations', err);
|
|
2953
|
-
// throw err;
|
|
2954
|
-
// }
|
|
2955
2939
|
conversation_item.text = transcript?.data || transcript || '';
|
|
2956
2940
|
conversation_item.process_stat = 'full';
|
|
2957
2941
|
const conversation_item_save_ret = await db_module.save_app_couch_doc(account_profile_info.app_id, conversation_item);
|