@xuda.io/ai_module 1.1.4833 → 1.1.4835
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 +17 -10
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -3412,8 +3412,9 @@ export const create_conversation = async function (req, job_id, headers) {
|
|
|
3412
3412
|
let conversation_obj;
|
|
3413
3413
|
try {
|
|
3414
3414
|
conversation_obj = await client.conversations.create();
|
|
3415
|
+
report_ai_status('conversations');
|
|
3415
3416
|
} catch (err) {
|
|
3416
|
-
report_ai_status('
|
|
3417
|
+
report_ai_status('conversations', err);
|
|
3417
3418
|
throw err;
|
|
3418
3419
|
}
|
|
3419
3420
|
|
|
@@ -3700,15 +3701,21 @@ const contact_chat_conversation = async function (req, job_id, headers) {
|
|
|
3700
3701
|
const sender_app_id = account_profile_info.app_id;
|
|
3701
3702
|
let sender_conversation_doc = await db_module.get_app_couch_doc_native(sender_app_id, conversation_id);
|
|
3702
3703
|
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3704
|
+
let item;
|
|
3705
|
+
try {
|
|
3706
|
+
item = await client.conversations.items.create(conversation_doc.reference_conversation_id, {
|
|
3707
|
+
items: [
|
|
3708
|
+
{
|
|
3709
|
+
type: 'message',
|
|
3710
|
+
role: 'user',
|
|
3711
|
+
content: [{ type: 'input_text', text: prompt }],
|
|
3712
|
+
},
|
|
3713
|
+
],
|
|
3714
|
+
});
|
|
3715
|
+
} catch (err) {
|
|
3716
|
+
report_ai_status('vectorStores', err);
|
|
3717
|
+
throw err;
|
|
3718
|
+
}
|
|
3712
3719
|
|
|
3713
3720
|
// const obj = { id: item.data[0].id, ts: Date.now(), uid, read: true, conversation_type: 'chat' };
|
|
3714
3721
|
// receiver_conversation_doc.messages.push(obj);
|