@xuda.io/ai_module 1.1.4987 → 1.1.4989

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 +7 -6
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -2394,7 +2394,7 @@ const upload_agent_files = async function (uid, agent_doc) {
2394
2394
  if (tool.type === 'file_search') {
2395
2395
  if (!_.isEmpty(tool.file)) {
2396
2396
  if (!tool.file.file_id) {
2397
- const validation_ret = drive_ms.file_upload_validator(tool.file.name);
2397
+ const validation_ret = await drive_ms.file_upload_validator(tool.file.name);
2398
2398
  if (!validation_ret.valid) {
2399
2399
  throw new Error(validation_ret.error);
2400
2400
  }
@@ -3297,7 +3297,7 @@ export const upload_prompt_attachment = async function (req, job_id, headers, fi
3297
3297
 
3298
3298
  const file_name = file_obj?.['originalname'];
3299
3299
 
3300
- const validation_ret = drive_ms.file_upload_validator(file_name);
3300
+ const validation_ret = await drive_ms.file_upload_validator(file_name);
3301
3301
 
3302
3302
  if (!validation_ret.valid) {
3303
3303
  throw new Error(validation_ret.error);
@@ -3363,7 +3363,7 @@ function getFirstNWords(text, n = 10) {
3363
3363
  }
3364
3364
 
3365
3365
  export const create_conversation = async function (req, job_id, headers) {
3366
- const { profile_id, uid, prompt, perform_ai_execution = true, email_id, email_direction = 'out', from_mailbox, date_created } = req;
3366
+ const { profile_id, uid, prompt, perform_ai_execution = true, email_id, email_direction = 'out', from_mailbox, date_created, ai_model = _conf.default_ai_model } = req;
3367
3367
  let { reference_type, reference_id = '', conversation_type, email_recipient_type } = req;
3368
3368
 
3369
3369
  const account_profile_info = await get_active_account_profile_info(uid, profile_id);
@@ -3415,6 +3415,7 @@ export const create_conversation = async function (req, job_id, headers) {
3415
3415
  process_stat: perform_ai_execution ? 'full' : 'partial',
3416
3416
  from_mailbox,
3417
3417
  email_recipient_type,
3418
+ model: ai_model,
3418
3419
  };
3419
3420
  const save_ret = await db_module.save_app_couch_doc(account_profile_info.app_id, conversation_doc);
3420
3421
 
@@ -6049,7 +6050,7 @@ export const get_transcript = async function (uid, app_id, conversation_id, acco
6049
6050
  return Buffer.concat(chunks);
6050
6051
  }
6051
6052
 
6052
- const validation_ret = drive_ms.file_upload_validator(filename);
6053
+ const validation_ret = await drive_ms.file_upload_validator(filename);
6053
6054
  if (!validation_ret.valid) {
6054
6055
  throw new Error(validation_ret.error);
6055
6056
  }
@@ -6177,7 +6178,7 @@ const attachment_handler = async function (uid, app_id, conversation_id, attachm
6177
6178
  // return Buffer.concat(chunks);
6178
6179
  // }
6179
6180
 
6180
- // const validation_ret = drive_ms.file_upload_validator(filename);
6181
+ // const validation_ret = await drive_ms.file_upload_validator(filename);
6181
6182
  // if (!validation_ret.valid) {
6182
6183
  // throw new Error(validation_ret.error);
6183
6184
  // }
@@ -6623,7 +6624,7 @@ const save_drive_file_to_disk = async function (drive_file) {
6623
6624
  const tempDir = os.tmpdir();
6624
6625
 
6625
6626
  const tempOutputPath = path.join(tempDir, drive_file.filename + '_' + Date.now());
6626
- const validation_ret = drive_ms.file_upload_validator(drive_file.filename);
6627
+ const validation_ret = await drive_ms.file_upload_validator(drive_file.filename);
6627
6628
 
6628
6629
  // 5. Write the downloaded image to disk
6629
6630
  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.4987",
3
+ "version": "1.1.4989",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",