@xuda.io/ai_module 1.1.4529 → 1.1.4531
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 -7
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -4409,7 +4409,6 @@ const chat_note = async function (req, job_id, headers) {
|
|
|
4409
4409
|
};
|
|
4410
4410
|
|
|
4411
4411
|
const chat_email = async function (req, job_id, headers) {
|
|
4412
|
-
debugger;
|
|
4413
4412
|
const { uid, email_id, perform_ai_execution = true, from_mailbox } = req;
|
|
4414
4413
|
const account_profile_info = await account_module.get_active_account_profile_info(uid);
|
|
4415
4414
|
let { prompt: body, conversation_doc, attachments = [], ai_agents } = req;
|
|
@@ -4451,8 +4450,10 @@ const chat_email = async function (req, job_id, headers) {
|
|
|
4451
4450
|
if (!sent_email_result.success) {
|
|
4452
4451
|
throw new Error('error sending email');
|
|
4453
4452
|
}
|
|
4454
|
-
|
|
4455
|
-
|
|
4453
|
+
let email_attachments = [];
|
|
4454
|
+
for (const attachment of attachments) {
|
|
4455
|
+
email_attachments.push(await save_drive_file_to_disk(attachment));
|
|
4456
|
+
}
|
|
4456
4457
|
}
|
|
4457
4458
|
|
|
4458
4459
|
if (perform_ai_execution) {
|
|
@@ -7015,15 +7016,15 @@ const save_drive_file_to_disk = async function (drive_file) {
|
|
|
7015
7016
|
|
|
7016
7017
|
const tempDir = os.tmpdir();
|
|
7017
7018
|
|
|
7018
|
-
const
|
|
7019
|
+
const tempOutputPath = path.join(tempDir, drive_file.filename + '_' + Date.now());
|
|
7019
7020
|
|
|
7020
7021
|
// 5. Write the downloaded image to disk
|
|
7021
|
-
fs.writeFileSync(
|
|
7022
|
+
fs.writeFileSync(tempOutputPath, imageBuffer);
|
|
7022
7023
|
/////////////////////////////////
|
|
7023
7024
|
|
|
7024
7025
|
return {
|
|
7025
|
-
filename:
|
|
7026
|
-
path:
|
|
7026
|
+
filename: drive_file.filename,
|
|
7027
|
+
path: tempOutputPath,
|
|
7027
7028
|
contentType: 'application/pdf',
|
|
7028
7029
|
};
|
|
7029
7030
|
};
|