@xuda.io/ai_module 1.1.4868 → 1.1.4870

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 +20 -16
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -3442,6 +3442,7 @@ export const create_conversation = async function (req, job_id, headers) {
3442
3442
  prompt,
3443
3443
  rtl: _common.detectRTL(prompt),
3444
3444
  process_stat: perform_ai_execution ? 'full' : 'partial',
3445
+ from_mailbox,
3445
3446
  };
3446
3447
  const save_ret = await db_module.save_app_couch_doc(account_profile_info.app_id, conversation_doc);
3447
3448
 
@@ -6194,6 +6195,8 @@ const attachment_handler = async function (uid, app_id, conversation_id, attachm
6194
6195
  let transcript;
6195
6196
  try {
6196
6197
  if (conversation_doc.reference_type === 'contacts' && conversation_doc.conversation_type === 'email') {
6198
+ let contact_doc = await account_module.get_contact(uid, conversation_doc.reference_id);
6199
+ if (!contact_doc.deep_research) throw new Error('deep research not set');
6197
6200
  }
6198
6201
 
6199
6202
  transcript = await get_transcript(file.filename);
@@ -6201,22 +6204,23 @@ const attachment_handler = async function (uid, app_id, conversation_id, attachm
6201
6204
  process_stat = 'partial';
6202
6205
  }
6203
6206
  let items;
6204
- try {
6205
- items = await client.conversations.items.create(conversation_doc.reference_conversation_id, {
6206
- items: [
6207
- {
6208
- type: 'message',
6209
- role: 'system',
6210
- content: [{ type: 'input_text', text: `the user attached file name: ${file.filename} with content: ${transcript?.data || transcript || ''}` }],
6211
- },
6212
- ],
6213
- });
6214
- report_ai_status('conversations');
6215
- } catch (err) {
6216
- report_ai_status('conversations', err);
6217
- 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
+ }
6218
6223
  }
6219
-
6220
6224
  let out_conversation_item_obj = {
6221
6225
  _id: await _common.xuda_get_uuid('chat_conversation_item'),
6222
6226
  stat: 3,
@@ -6231,7 +6235,7 @@ const attachment_handler = async function (uid, app_id, conversation_id, attachm
6231
6235
  reference_id: conversation_doc.reference_id,
6232
6236
  direction: 'out',
6233
6237
  role: 'user',
6234
- conversation_item_reference_id: items.last_id,
6238
+ conversation_item_reference_id: items?.last_id,
6235
6239
  file,
6236
6240
  read: { [uid]: Date.now() },
6237
6241
  process_stat,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.4868",
3
+ "version": "1.1.4870",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",