@xuda.io/ai_module 1.1.4546 → 1.1.4548
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 +9 -6
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -4455,12 +4455,15 @@ const chat_email = async function (req, job_id, headers) {
|
|
|
4455
4455
|
//////////
|
|
4456
4456
|
|
|
4457
4457
|
let subject = last_email_item?.subject ? '' : body;
|
|
4458
|
-
if (body.split(' ').length > 10) {
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4458
|
+
if (!last_email_item && body.split(' ').length > 10) {
|
|
4459
|
+
if (!last_email_item && body.split(' ').length > 10) {
|
|
4460
|
+
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 });
|
|
4461
|
+
if (subject_ret.code < 0) {
|
|
4462
|
+
throw new Error('something wrong creating email subject');
|
|
4463
|
+
}
|
|
4464
|
+
subject = subject_ret.data;
|
|
4462
4465
|
}
|
|
4463
|
-
|
|
4466
|
+
} else {
|
|
4464
4467
|
}
|
|
4465
4468
|
debugger;
|
|
4466
4469
|
let email_attachments = [];
|
|
@@ -4496,7 +4499,7 @@ const chat_email = async function (req, job_id, headers) {
|
|
|
4496
4499
|
sender_conversation_doc.messages.push(obj);
|
|
4497
4500
|
await db_module.save_app_couch_doc_native(sender_app_id, sender_conversation_doc);
|
|
4498
4501
|
|
|
4499
|
-
const save_ret = await db_module.save_app_couch_doc_native(sender_app_id, { _id: obj.id, stat: 3, docType: 'chat_conversation_item', sent_email_result, ts: obj.ts, uid, conversation_type: obj.conversation_type, date_created_ts: obj.ts, conversation_id, body, email_id });
|
|
4502
|
+
const save_ret = await db_module.save_app_couch_doc_native(sender_app_id, { _id: obj.id, stat: 3, docType: 'chat_conversation_item', sent_email_result, ts: obj.ts, uid, conversation_type: obj.conversation_type, date_created_ts: obj.ts, conversation_id, body, email_id, subject });
|
|
4500
4503
|
|
|
4501
4504
|
return save_ret;
|
|
4502
4505
|
} catch (err) {
|