@xuda.io/ai_module 1.1.4796 → 1.1.4798
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 +8 -24
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -4678,6 +4678,7 @@ const chat_email = async function (req, job_id, headers) {
|
|
|
4678
4678
|
subject,
|
|
4679
4679
|
last_email_item_id: last_email_item?._id,
|
|
4680
4680
|
rtl: _common.detectRTL(body),
|
|
4681
|
+
process_stat: perform_ai_execution ? 'full' : 'partial',
|
|
4681
4682
|
};
|
|
4682
4683
|
|
|
4683
4684
|
const save_ret = await db_module.save_app_couch_doc(sender_app_id, out_conversation_item_obj);
|
|
@@ -6715,19 +6716,14 @@ const attachment_handler = async function (uid, app_id, conversation_id, attachm
|
|
|
6715
6716
|
return transcript;
|
|
6716
6717
|
};
|
|
6717
6718
|
|
|
6718
|
-
let file_names = [];
|
|
6719
|
+
// let file_names = [];
|
|
6719
6720
|
let system_message_items = [];
|
|
6720
6721
|
for (const file of attachments) {
|
|
6721
|
-
file_names.push(file.filename);
|
|
6722
|
-
|
|
6723
|
-
|
|
6724
|
-
|
|
6725
|
-
|
|
6726
|
-
// role: 'system',
|
|
6727
|
-
// content: [{ type: 'input_text', text: `the user attached file name: ${file.filename} with content: ${transcript.data || transcript}` }],
|
|
6728
|
-
// });
|
|
6729
|
-
|
|
6730
|
-
// prompt += await generate_XU_markdown('attachment', file); //`[]`;
|
|
6722
|
+
// file_names.push(file.filename);
|
|
6723
|
+
let transcript;
|
|
6724
|
+
try {
|
|
6725
|
+
transcript = await get_transcript(file.filename);
|
|
6726
|
+
} catch (error) {}
|
|
6731
6727
|
|
|
6732
6728
|
const items = await client.conversations.items.create(conversation_doc.reference_conversation_id, {
|
|
6733
6729
|
items: [
|
|
@@ -6739,11 +6735,6 @@ const attachment_handler = async function (uid, app_id, conversation_id, attachm
|
|
|
6739
6735
|
],
|
|
6740
6736
|
});
|
|
6741
6737
|
|
|
6742
|
-
// const obj = { id: items.last_id, ts: Date.now(), conversation_type: 'attachment', file };
|
|
6743
|
-
// system_message_items.push(obj);
|
|
6744
|
-
|
|
6745
|
-
// await db_module.save_app_couch_doc_native(account_profile_info.app_id, { _id: obj.id, stat: 3, docType: 'chat_conversation_item', ts: obj.ts, uid, conversation_type: obj.conversation_type, date_created_ts: obj.ts, conversation_id, file, transcript, reference_id: conversation_doc.reference_id });
|
|
6746
|
-
///////////////
|
|
6747
6738
|
let out_conversation_item_obj = {
|
|
6748
6739
|
_id: await _common.xuda_get_uuid('chat_conversation_item'),
|
|
6749
6740
|
stat: 3,
|
|
@@ -6766,18 +6757,11 @@ const attachment_handler = async function (uid, app_id, conversation_id, attachm
|
|
|
6766
6757
|
system_message_items.push(out_conversation_item_obj);
|
|
6767
6758
|
}
|
|
6768
6759
|
|
|
6769
|
-
// const items = await client.conversations.items.create(conversation_id, {
|
|
6770
|
-
// items: system_message_items,
|
|
6771
|
-
// });
|
|
6772
|
-
|
|
6773
|
-
// console.log(items.data);
|
|
6774
|
-
|
|
6775
6760
|
conversation_doc = await db_module.get_app_couch_doc_native(app_id, conversation_id);
|
|
6776
6761
|
|
|
6777
6762
|
conversation_doc.ts = Date.now();
|
|
6778
6763
|
conversation_doc.stat = 2;
|
|
6779
|
-
|
|
6780
|
-
// s.push(obj);
|
|
6764
|
+
|
|
6781
6765
|
await db_module.save_app_couch_doc_native(app_id, conversation_doc);
|
|
6782
6766
|
return system_message_items;
|
|
6783
6767
|
};
|