@xuda.io/ai_module 1.1.4347 → 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 +29 -23
  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);
@@ -6784,25 +6784,31 @@ const get_profile_image = async function (uid, account_type = 'business', name,
6784
6784
 
6785
6785
  debugger;
6786
6786
  try {
6787
+ // first attempt
6787
6788
  let url = await get_url();
6788
- if (!url.includes('https://')) {
6789
+ if (!url.substr(0, 7, 'https://')) {
6790
+ // second attempt
6789
6791
  url = await get_url();
6790
- } // throw new Error('not valid url');
6791
- let file;
6792
- try {
6793
- file = await get_image_blob_from_downloaded_image(url);
6794
- } catch (err) {
6795
- if (!err.message.includes('Failed to fetch image URL')) {
6796
- console.error(err);
6797
- return '';
6792
+ if (!url.substr(0, 7, 'https://')) {
6793
+ factual_image_mode = true;
6798
6794
  }
6799
-
6795
+ } else {
6796
+ let file;
6800
6797
  try {
6801
- url = await get_url();
6802
6798
  file = await get_image_blob_from_downloaded_image(url);
6803
6799
  } catch (err) {
6804
- // create factual image
6805
- 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
+ }
6806
6812
  }
6807
6813
  }
6808
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.4347",
3
+ "version": "1.1.4348",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",