@xuda.io/ai_module 1.1.5491 → 1.1.5493
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 +7 -1
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -3515,6 +3515,10 @@ function getFirstNWords(text, n = 10) {
|
|
|
3515
3515
|
return words.slice(0, n).join(' ');
|
|
3516
3516
|
}
|
|
3517
3517
|
|
|
3518
|
+
export const create_openai_conversation = async function () {
|
|
3519
|
+
return await client.conversations.create();
|
|
3520
|
+
};
|
|
3521
|
+
|
|
3518
3522
|
export const create_conversation = async function (req, job_id, headers) {
|
|
3519
3523
|
const { profile_id, uid, prompt, perform_ai_execution = true, email_id, direction = 'out', from_mailbox, date_created, ai_model = _conf.default_ai_model } = req;
|
|
3520
3524
|
let { reference_type, reference_id = '', conversation_type, email_recipient_type } = req;
|
|
@@ -3539,7 +3543,7 @@ export const create_conversation = async function (req, job_id, headers) {
|
|
|
3539
3543
|
|
|
3540
3544
|
let conversation_obj;
|
|
3541
3545
|
try {
|
|
3542
|
-
conversation_obj = await
|
|
3546
|
+
conversation_obj = await create_openai_conversation();
|
|
3543
3547
|
report_ai_status('conversations');
|
|
3544
3548
|
} catch (err) {
|
|
3545
3549
|
report_ai_status('conversations', err);
|
|
@@ -4124,6 +4128,8 @@ const auto_response = async function (uid, profile_id, conversation_id) {
|
|
|
4124
4128
|
|
|
4125
4129
|
if (account_profile_doc.auto_respond_mode === 'when_offline' && account_doc.socket_id) return;
|
|
4126
4130
|
if (account_profile_doc.auto_respond_mode !== 'always') return;
|
|
4131
|
+
|
|
4132
|
+
///
|
|
4127
4133
|
};
|
|
4128
4134
|
|
|
4129
4135
|
const ai_chat_conversation = async function (req, job_id, headers) {
|