@xuda.io/ai_module 1.1.4473 → 1.1.4475
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 +5 -5
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -4361,7 +4361,7 @@ const chat_note = async function (req, job_id, headers) {
|
|
|
4361
4361
|
};
|
|
4362
4362
|
|
|
4363
4363
|
const chat_email = async function (req, job_id, headers) {
|
|
4364
|
-
const { uid } = req;
|
|
4364
|
+
const { uid, email_id, perform_ai_execution = true } = req;
|
|
4365
4365
|
const account_profile_info = await account_module.get_active_account_profile_info(uid);
|
|
4366
4366
|
let { prompt: body, conversation_doc, attachments = [], ai_agents } = req;
|
|
4367
4367
|
try {
|
|
@@ -4369,9 +4369,9 @@ const chat_email = async function (req, job_id, headers) {
|
|
|
4369
4369
|
|
|
4370
4370
|
const sender_app_id = account_profile_info.app_id;
|
|
4371
4371
|
let sender_conversation_doc = await db_module.get_app_couch_doc_native(sender_app_id, conversation_id);
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4372
|
+
if (perform_ai_execution) {
|
|
4373
|
+
await attachment_handler(uid, sender_app_id, conversation_id, attachments, account_profile_info);
|
|
4374
|
+
}
|
|
4375
4375
|
const item = await client.conversations.items.create(conversation_id, {
|
|
4376
4376
|
items: [
|
|
4377
4377
|
{
|
|
@@ -4387,7 +4387,7 @@ const chat_email = async function (req, job_id, headers) {
|
|
|
4387
4387
|
sender_conversation_doc.messages.push(obj);
|
|
4388
4388
|
await db_module.save_app_couch_doc_native(sender_app_id, sender_conversation_doc);
|
|
4389
4389
|
|
|
4390
|
-
const save_ret = await db_module.save_app_couch_doc_native(sender_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, body });
|
|
4390
|
+
const save_ret = await db_module.save_app_couch_doc_native(sender_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, body, email_id });
|
|
4391
4391
|
|
|
4392
4392
|
return save_ret;
|
|
4393
4393
|
} catch (err) {
|