@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.
Files changed (2) hide show
  1. package/index.mjs +32 -19
  2. 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
- const item = await client.conversations.items.create(conversation_doc.reference_conversation_id, {
3766
- items: [
3767
- {
3768
- type: 'message',
3769
- role: 'user',
3770
- content: [{ type: 'input_text', text: body }],
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
- const item = await client.conversations.items.create(conversation_doc.reference_conversation_id, {
3885
- items: [
3886
- {
3887
- type: 'message',
3888
- role: 'user',
3889
- content: [{ type: 'input_text', text: body || '' }],
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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.4836",
3
+ "version": "1.1.4838",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",