@xuda.io/ai_module 1.1.4869 → 1.1.4871

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 +18 -17
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -3920,7 +3920,7 @@ const chat_email = async function (req, job_id, headers) {
3920
3920
  uid,
3921
3921
  conversation_type: 'email',
3922
3922
  type: 'email',
3923
- date_created_ts: Date.now(),
3923
+ date_created_ts: conversation_doc.date_created_ts, //Date.now(),
3924
3924
  ts: Date.now(),
3925
3925
  conversation_id,
3926
3926
  text: body,
@@ -6204,22 +6204,23 @@ const attachment_handler = async function (uid, app_id, conversation_id, attachm
6204
6204
  process_stat = 'partial';
6205
6205
  }
6206
6206
  let items;
6207
- try {
6208
- items = await client.conversations.items.create(conversation_doc.reference_conversation_id, {
6209
- items: [
6210
- {
6211
- type: 'message',
6212
- role: 'system',
6213
- content: [{ type: 'input_text', text: `the user attached file name: ${file.filename} with content: ${transcript?.data || transcript || ''}` }],
6214
- },
6215
- ],
6216
- });
6217
- report_ai_status('conversations');
6218
- } catch (err) {
6219
- report_ai_status('conversations', err);
6220
- throw err;
6207
+ if (transcript) {
6208
+ try {
6209
+ items = await client.conversations.items.create(conversation_doc.reference_conversation_id, {
6210
+ items: [
6211
+ {
6212
+ type: 'message',
6213
+ role: 'system',
6214
+ content: [{ type: 'input_text', text: `the user attached file name: ${file.filename} with content: ${transcript?.data || transcript || ''}` }],
6215
+ },
6216
+ ],
6217
+ });
6218
+ report_ai_status('conversations');
6219
+ } catch (err) {
6220
+ report_ai_status('conversations', err);
6221
+ throw err;
6222
+ }
6221
6223
  }
6222
-
6223
6224
  let out_conversation_item_obj = {
6224
6225
  _id: await _common.xuda_get_uuid('chat_conversation_item'),
6225
6226
  stat: 3,
@@ -6234,7 +6235,7 @@ const attachment_handler = async function (uid, app_id, conversation_id, attachm
6234
6235
  reference_id: conversation_doc.reference_id,
6235
6236
  direction: 'out',
6236
6237
  role: 'user',
6237
- conversation_item_reference_id: items.last_id,
6238
+ conversation_item_reference_id: items?.last_id,
6238
6239
  file,
6239
6240
  read: { [uid]: Date.now() },
6240
6241
  process_stat,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.4869",
3
+ "version": "1.1.4871",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",