@xuda.io/ai_module 1.1.4988 → 1.1.4990

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 +15 -5
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -1326,6 +1326,16 @@ export const get_ai_chats = async function (req, job_id, headers) {
1326
1326
  doc.notifications = contact_chat_conversation_count_ret - contact_chat_conversation_read_ret;
1327
1327
  doc.chats = doc.interactions;
1328
1328
 
1329
+ // get conversation item
1330
+ let opt = {
1331
+ selector: {
1332
+ docType: 'chat_conversation_item',
1333
+ conversation_id: doc._id,
1334
+ },
1335
+ limit: 1,
1336
+ };
1337
+ const conversation_item = await db_module.find_app_couch_query(account_profile_info.app_id, opt);
1338
+
1329
1339
  // doc.notifications = 0;
1330
1340
  // doc.interactions = doc?.messages?.length || 0;
1331
1341
  // for (let msg of doc.messages) {
@@ -2394,7 +2404,7 @@ const upload_agent_files = async function (uid, agent_doc) {
2394
2404
  if (tool.type === 'file_search') {
2395
2405
  if (!_.isEmpty(tool.file)) {
2396
2406
  if (!tool.file.file_id) {
2397
- const validation_ret = drive_ms.file_upload_validator(tool.file.name);
2407
+ const validation_ret = await drive_ms.file_upload_validator(tool.file.name);
2398
2408
  if (!validation_ret.valid) {
2399
2409
  throw new Error(validation_ret.error);
2400
2410
  }
@@ -3297,7 +3307,7 @@ export const upload_prompt_attachment = async function (req, job_id, headers, fi
3297
3307
 
3298
3308
  const file_name = file_obj?.['originalname'];
3299
3309
 
3300
- const validation_ret = drive_ms.file_upload_validator(file_name);
3310
+ const validation_ret = await drive_ms.file_upload_validator(file_name);
3301
3311
 
3302
3312
  if (!validation_ret.valid) {
3303
3313
  throw new Error(validation_ret.error);
@@ -6050,7 +6060,7 @@ export const get_transcript = async function (uid, app_id, conversation_id, acco
6050
6060
  return Buffer.concat(chunks);
6051
6061
  }
6052
6062
 
6053
- const validation_ret = drive_ms.file_upload_validator(filename);
6063
+ const validation_ret = await drive_ms.file_upload_validator(filename);
6054
6064
  if (!validation_ret.valid) {
6055
6065
  throw new Error(validation_ret.error);
6056
6066
  }
@@ -6178,7 +6188,7 @@ const attachment_handler = async function (uid, app_id, conversation_id, attachm
6178
6188
  // return Buffer.concat(chunks);
6179
6189
  // }
6180
6190
 
6181
- // const validation_ret = drive_ms.file_upload_validator(filename);
6191
+ // const validation_ret = await drive_ms.file_upload_validator(filename);
6182
6192
  // if (!validation_ret.valid) {
6183
6193
  // throw new Error(validation_ret.error);
6184
6194
  // }
@@ -6624,7 +6634,7 @@ const save_drive_file_to_disk = async function (drive_file) {
6624
6634
  const tempDir = os.tmpdir();
6625
6635
 
6626
6636
  const tempOutputPath = path.join(tempDir, drive_file.filename + '_' + Date.now());
6627
- const validation_ret = drive_ms.file_upload_validator(drive_file.filename);
6637
+ const validation_ret = await drive_ms.file_upload_validator(drive_file.filename);
6628
6638
 
6629
6639
  // 5. Write the downloaded image to disk
6630
6640
  fs.writeFileSync(tempOutputPath, imageBuffer);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.4988",
3
+ "version": "1.1.4990",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",