@xuda.io/ai_module 1.1.4333 → 1.1.4335

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 -4
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -6783,6 +6783,8 @@ const get_profile_image = async function (uid, account_type = 'business', name,
6783
6783
  url = await get_url();
6784
6784
  file = await return_image_blob_from_downloaded_image(url);
6785
6785
  } catch (err) {
6786
+ // create factual image
6787
+
6786
6788
  return console.error(err);
6787
6789
  }
6788
6790
  }
@@ -6792,14 +6794,14 @@ const get_profile_image = async function (uid, account_type = 'business', name,
6792
6794
  const prompt = `
6793
6795
  extract the logo from the image
6794
6796
  `;
6795
- const logo_response = await client.images.edit({
6797
+ const image_response = await client.images.edit({
6796
6798
  model,
6797
6799
  image: file.image_blob, //logo
6798
6800
  prompt,
6799
6801
  background: 'transparent',
6800
6802
  });
6801
6803
 
6802
- let imageBase64 = await normalizeBase64To1024(logo_response.data[0].b64_json);
6804
+ let imageBase64 = await normalizeBase64To1024(image_response.data[0].b64_json);
6803
6805
 
6804
6806
  const outputBuffer = Buffer.from(imageBase64, 'base64');
6805
6807
  const outputPath = file.tempOutputPath;
@@ -6817,11 +6819,12 @@ const get_profile_image = async function (uid, account_type = 'business', name,
6817
6819
 
6818
6820
  const drive_ret = await drive_module.upload_drive_file_user({ uid, path: '/Profile Images' }, job_id, headers, file_obj);
6819
6821
 
6820
- record_chat_usage(uid, logo_response.usage.input_tokens, logo_response.usage.output_tokens, 'business logo', prompt, model, { url }, account_profile_info);
6822
+ record_chat_usage(uid, image_response.usage.input_tokens, image_response.usage.output_tokens, 'business logo', prompt, model, { url }, account_profile_info);
6821
6823
 
6822
6824
  return drive_ret;
6823
6825
  } catch (err) {
6824
- return console.error(err);
6826
+ console.error(err);
6827
+ return '';
6825
6828
  }
6826
6829
  };
6827
6830
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.4333",
3
+ "version": "1.1.4335",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",