@xuda.io/ai_module 1.1.4542 → 1.1.4544
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 +18 -0
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -4438,6 +4438,24 @@ const chat_email = async function (req, job_id, headers) {
|
|
|
4438
4438
|
|
|
4439
4439
|
// send an email by user invocation
|
|
4440
4440
|
if (!from_mailbox) {
|
|
4441
|
+
// get last email
|
|
4442
|
+
|
|
4443
|
+
const chat_conversation_item = await db_module.find_app_couch_query(account_profile_info.app_id, {
|
|
4444
|
+
selector: {
|
|
4445
|
+
docType: 'chat_conversation_item',
|
|
4446
|
+
conversation_type: 'email',
|
|
4447
|
+
conversation_id: conversation_doc._id,
|
|
4448
|
+
},
|
|
4449
|
+
limit: 1,
|
|
4450
|
+
fields: ['_id'],
|
|
4451
|
+
});
|
|
4452
|
+
|
|
4453
|
+
if (chat_conversation_item.docs.length) {
|
|
4454
|
+
throw new Error('the email already processed');
|
|
4455
|
+
}
|
|
4456
|
+
|
|
4457
|
+
//////////
|
|
4458
|
+
|
|
4441
4459
|
let subject = _thread_reentry ? '' : body;
|
|
4442
4460
|
if (body.split(' ').length > 10) {
|
|
4443
4461
|
const subject_ret = await submit_chat_gpt_prompt({ uid, prompt: `create title for the prompt return 5 words result maximum text only without options : ${body}`, model: 'gpt-5-nano', metadata: { conversation_id: conversation_doc._id, func: 'chat_email' }, account_profile_info });
|