@xuda.io/ai_module 1.1.4353 → 1.1.4354
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.
- package/index.mjs +16 -21
- 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
|
-
|
|
5296
|
-
|
|
5297
|
-
|
|
5298
|
-
|
|
5299
|
-
|
|
5300
|
-
|
|
5301
|
-
|
|
5302
|
-
|
|
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);
|
|
@@ -6734,7 +6734,7 @@ export const is_business_contact = async function (uid, email, name, subject, bo
|
|
|
6734
6734
|
} catch (error) {}
|
|
6735
6735
|
};
|
|
6736
6736
|
|
|
6737
|
-
const get_profile_image = async function (uid, account_type = 'business', name, facts = {}, account_profile_info) {
|
|
6737
|
+
const get_profile_image = async function (uid, account_type = 'business', name, facts = {}, account_profile_info, job_id, headers) {
|
|
6738
6738
|
const tempDir = os.tmpdir();
|
|
6739
6739
|
const uniqueId = Date.now() + '_' + Math.random().toString(36).substring(7);
|
|
6740
6740
|
const tempOutputPath = path.join(tempDir, `output_${uniqueId}.png`);
|
|
@@ -6781,12 +6781,12 @@ const get_profile_image = async function (uid, account_type = 'business', name,
|
|
|
6781
6781
|
account_profile_info,
|
|
6782
6782
|
tools: [{ type: 'web_search_preview' }],
|
|
6783
6783
|
});
|
|
6784
|
-
console.log('=============', ret);
|
|
6784
|
+
// console.log('=============', ret);
|
|
6785
6785
|
|
|
6786
6786
|
return ret.data;
|
|
6787
6787
|
};
|
|
6788
6788
|
|
|
6789
|
-
debugger;
|
|
6789
|
+
// debugger;
|
|
6790
6790
|
try {
|
|
6791
6791
|
// first attempt
|
|
6792
6792
|
let url = await get_url();
|
|
@@ -6842,12 +6842,12 @@ const get_profile_image = async function (uid, account_type = 'business', name,
|
|
|
6842
6842
|
|
|
6843
6843
|
const drive_ret = await drive_module.upload_drive_file_user({ uid, path: '/Profile Images' }, job_id, headers, file_obj);
|
|
6844
6844
|
|
|
6845
|
-
record_chat_usage(uid, image_response.usage.input_tokens, image_response.usage.output_tokens, '
|
|
6845
|
+
record_chat_usage(uid, image_response.usage.input_tokens, image_response.usage.output_tokens, 'profile image', prompt, model, { url }, account_profile_info);
|
|
6846
6846
|
|
|
6847
6847
|
return drive_ret;
|
|
6848
6848
|
} catch (err) {
|
|
6849
6849
|
console.error(err);
|
|
6850
|
-
return
|
|
6850
|
+
return;
|
|
6851
6851
|
}
|
|
6852
6852
|
};
|
|
6853
6853
|
|
|
@@ -6937,7 +6937,7 @@ const get_image_blob_from_downloaded_image = async function (url) {
|
|
|
6937
6937
|
|
|
6938
6938
|
const inputExt = path.extname(url) || '.jpg';
|
|
6939
6939
|
const tempInputPath = path.join(tempDir, `input_${uniqueId}${inputExt}`);
|
|
6940
|
-
const tempOutputPath = path.join(tempDir, `output_${uniqueId}.png`); // Output is always PNG (transparent)
|
|
6940
|
+
// const tempOutputPath = path.join(tempDir, `output_${uniqueId}.png`); // Output is always PNG (transparent)
|
|
6941
6941
|
|
|
6942
6942
|
// 5. Write the downloaded image to disk
|
|
6943
6943
|
fs.writeFileSync(tempInputPath, imageBuffer);
|
|
@@ -6961,9 +6961,4 @@ const get_image_blob_from_downloaded_image = async function (url) {
|
|
|
6961
6961
|
);
|
|
6962
6962
|
|
|
6963
6963
|
return images[0].image_blob;
|
|
6964
|
-
// return { image_blob: images[0].image_blob, is_transparent: images[0].is_transparent, tempOutputPath };
|
|
6965
|
-
|
|
6966
|
-
// } catch (err) {
|
|
6967
|
-
// console.error(err);
|
|
6968
|
-
// }
|
|
6969
6964
|
};
|