@xuda.io/account_module 1.2.1978 → 1.2.1980
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 -32
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -2897,22 +2897,22 @@ export const set_deep_research_contact = async function (req, job_id, headers) {
|
|
|
2897
2897
|
var contact_doc = await get_contact(uid, contact_id);
|
|
2898
2898
|
contact_doc.deep_research = true;
|
|
2899
2899
|
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2900
|
+
if (contact_doc.account_type === 'business') {
|
|
2901
|
+
contact_doc.business_info = await ai_module.get_business_info(uid, '', contact_doc.email, account_profile_info);
|
|
2902
|
+
if (contact_doc.business_info.business_name !== 'Not available') {
|
|
2903
|
+
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);
|
|
2904
|
+
} else {
|
|
2905
|
+
contact_doc.account_type = 'personal';
|
|
2906
|
+
contact_doc.business_info = undefined;
|
|
2907
|
+
}
|
|
2908
|
+
}
|
|
2909
2909
|
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2910
|
+
if (contact_doc.account_type === 'personal' || contact_doc?.business_has_person) {
|
|
2911
|
+
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);
|
|
2912
|
+
if (!contact_doc.name) {
|
|
2913
|
+
contact_doc.name = await ai_module.get_name_from_email_addr(uid, contact_doc.email, account_profile_info);
|
|
2914
|
+
}
|
|
2915
|
+
}
|
|
2916
2916
|
|
|
2917
2917
|
const contact_save_ret = await save_contact(uid, contact_doc);
|
|
2918
2918
|
await delete_xuda_cache(contact_doc);
|
|
@@ -2925,7 +2925,7 @@ export const set_deep_research_contact = async function (req, job_id, headers) {
|
|
|
2925
2925
|
process_stat: 'partial',
|
|
2926
2926
|
},
|
|
2927
2927
|
});
|
|
2928
|
-
|
|
2928
|
+
|
|
2929
2929
|
for await (let conversation_item of conversation_items.docs) {
|
|
2930
2930
|
try {
|
|
2931
2931
|
const account_profile_info = await get_active_account_profile_info(conversation_item.uid);
|
|
@@ -2933,25 +2933,10 @@ export const set_deep_research_contact = async function (req, job_id, headers) {
|
|
|
2933
2933
|
|
|
2934
2934
|
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
2935
|
let items;
|
|
2936
|
-
|
|
2936
|
+
|
|
2937
2937
|
if (transcript) {
|
|
2938
2938
|
items = await ai_module.add_transcript_conversation_item(conversation_doc.reference_conversation_id, conversation_item.file.filename, transcript);
|
|
2939
2939
|
|
|
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
2940
|
conversation_item.text = transcript?.data || transcript || '';
|
|
2956
2941
|
conversation_item.process_stat = 'full';
|
|
2957
2942
|
const conversation_item_save_ret = await db_module.save_app_couch_doc(account_profile_info.app_id, conversation_item);
|