@xuda.io/ai_module 1.1.4346 → 1.1.4348

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 +32 -21
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -5291,16 +5291,16 @@ setTimeout(async () => {
5291
5291
  // });
5292
5292
 
5293
5293
  // ret = await get_profile_image(uid, 'business', 'ioshka media', {}, account_profile_info);
5294
- ret = await get_profile_image(
5295
- uid,
5296
- 'personal',
5297
- 'Glenn Willett',
5298
- {
5299
- email: 'glennwillett@schoolsponsoringregionzft.com',
5300
- body: 'We have a couple middle and elementary schools a few minutes from you in Boca Raton that have available sponsorship slots. The parents would see your sponsorship in the student progress reports each week.Is it okay if I send over the available spots?',
5301
- },
5302
- account_profile_info,
5303
- );
5294
+ // ret = await get_profile_image(
5295
+ // uid,
5296
+ // 'personal',
5297
+ // 'Glenn Willett',
5298
+ // {
5299
+ // email: 'glennwillett@schoolsponsoringregionzft.com',
5300
+ // body: 'We have a couple middle and elementary schools a few minutes from you in Boca Raton that have available sponsorship slots. The parents would see your sponsorship in the student progress reports each week.Is it okay if I send over the available spots?',
5301
+ // },
5302
+ // account_profile_info,
5303
+ // );
5304
5304
 
5305
5305
  console.log(ret);
5306
5306
  }, 1000);
@@ -6781,23 +6781,34 @@ const get_profile_image = async function (uid, account_type = 'business', name,
6781
6781
 
6782
6782
  return ret.data;
6783
6783
  };
6784
+
6785
+ debugger;
6784
6786
  try {
6787
+ // first attempt
6785
6788
  let url = await get_url();
6786
- if (!url.includes('https://')) {
6789
+ if (!url.substr(0, 7, 'https://')) {
6790
+ // second attempt
6787
6791
  url = await get_url();
6788
- } // throw new Error('not valid url');
6789
- let file;
6790
- try {
6791
- file = await get_image_blob_from_downloaded_image(url);
6792
- } catch (err) {
6793
- if (!err.message.includes('Failed to fetch image URL')) return console.error(err);
6794
-
6792
+ if (!url.substr(0, 7, 'https://')) {
6793
+ factual_image_mode = true;
6794
+ }
6795
+ } else {
6796
+ let file;
6795
6797
  try {
6796
- url = await get_url();
6797
6798
  file = await get_image_blob_from_downloaded_image(url);
6798
6799
  } catch (err) {
6799
- // create factual image
6800
- factual_image_mode = true;
6800
+ if (!err.message.includes('Failed to fetch image URL')) {
6801
+ console.error(err);
6802
+ return '';
6803
+ }
6804
+
6805
+ try {
6806
+ url = await get_url();
6807
+ file = await get_image_blob_from_downloaded_image(url);
6808
+ } catch (err) {
6809
+ // create factual image
6810
+ factual_image_mode = true;
6811
+ }
6801
6812
  }
6802
6813
  }
6803
6814
  if (factual_image_mode) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.4346",
3
+ "version": "1.1.4348",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",