@xuda.io/ai_module 1.1.4836 → 1.1.4838
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 +32 -19
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -3761,16 +3761,22 @@ const chat_note = async function (req, job_id, headers) {
|
|
|
3761
3761
|
let sender_conversation_doc = await db_module.get_app_couch_doc_native(sender_app_id, conversation_id);
|
|
3762
3762
|
|
|
3763
3763
|
await attachment_handler(uid, sender_app_id, conversation_id, attachments, account_profile_info);
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
items
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3764
|
+
let item;
|
|
3765
|
+
try {
|
|
3766
|
+
item = await client.conversations.items.create(conversation_doc.reference_conversation_id, {
|
|
3767
|
+
items: [
|
|
3768
|
+
{
|
|
3769
|
+
type: 'message',
|
|
3770
|
+
role: 'user',
|
|
3771
|
+
content: [{ type: 'input_text', text: body }],
|
|
3772
|
+
},
|
|
3773
|
+
],
|
|
3774
|
+
});
|
|
3775
|
+
report_ai_status('conversations');
|
|
3776
|
+
} catch (err) {
|
|
3777
|
+
report_ai_status('conversations', err);
|
|
3778
|
+
throw err;
|
|
3779
|
+
}
|
|
3774
3780
|
|
|
3775
3781
|
// let obj = { id: item.data[0].id, ts: Date.now(), uid, read: true, conversation_type: 'note' };
|
|
3776
3782
|
|
|
@@ -3881,15 +3887,22 @@ const chat_email = async function (req, job_id, headers) {
|
|
|
3881
3887
|
if (perform_ai_execution) {
|
|
3882
3888
|
await attachment_handler(uid, sender_app_id, conversation_id, attachments, account_profile_info);
|
|
3883
3889
|
}
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3890
|
+
let item;
|
|
3891
|
+
try {
|
|
3892
|
+
item = await client.conversations.items.create(conversation_doc.reference_conversation_id, {
|
|
3893
|
+
items: [
|
|
3894
|
+
{
|
|
3895
|
+
type: 'message',
|
|
3896
|
+
role: 'user',
|
|
3897
|
+
content: [{ type: 'input_text', text: body || '' }],
|
|
3898
|
+
},
|
|
3899
|
+
],
|
|
3900
|
+
});
|
|
3901
|
+
report_ai_status('conversations');
|
|
3902
|
+
} catch (err) {
|
|
3903
|
+
report_ai_status('conversations', err);
|
|
3904
|
+
throw err;
|
|
3905
|
+
}
|
|
3893
3906
|
|
|
3894
3907
|
// let obj = { id: item.data[0].id, ts: Date.now(), uid, read: true, conversation_type: 'email' };
|
|
3895
3908
|
|