@xuda.io/ai_module 1.1.4695 → 1.1.4697
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 +25 -19
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -6810,6 +6810,7 @@ export const get_profile_picture = async function (uid, account_type = 'business
|
|
|
6810
6810
|
const tempOutputPath = path.join(tempDir, `output_${uniqueId}.png`);
|
|
6811
6811
|
|
|
6812
6812
|
let prompt,
|
|
6813
|
+
url,
|
|
6813
6814
|
factual_prompt,
|
|
6814
6815
|
originalname,
|
|
6815
6816
|
factual_image_mode,
|
|
@@ -6867,31 +6868,36 @@ export const get_profile_picture = async function (uid, account_type = 'business
|
|
|
6867
6868
|
// debugger;
|
|
6868
6869
|
try {
|
|
6869
6870
|
// first attempt
|
|
6870
|
-
|
|
6871
|
-
let url = await get_url();
|
|
6872
|
-
|
|
6873
|
-
if (url.substr(0, 8) !== 'https://') {
|
|
6874
|
-
profile_picture_source = 'factual';
|
|
6875
|
-
// second attempt
|
|
6871
|
+
if (account_type === 'business') {
|
|
6876
6872
|
url = await get_url();
|
|
6873
|
+
|
|
6877
6874
|
if (url.substr(0, 8) !== 'https://') {
|
|
6878
|
-
factual_image_mode = true;
|
|
6879
6875
|
profile_picture_source = 'factual';
|
|
6880
|
-
|
|
6881
|
-
|
|
6882
|
-
|
|
6883
|
-
|
|
6884
|
-
|
|
6885
|
-
|
|
6886
|
-
}
|
|
6887
|
-
|
|
6888
|
-
|
|
6889
|
-
|
|
6876
|
+
// second attempt
|
|
6877
|
+
url = await get_url();
|
|
6878
|
+
if (url.substr(0, 8) !== 'https://') {
|
|
6879
|
+
factual_image_mode = true;
|
|
6880
|
+
profile_picture_source = 'factual';
|
|
6881
|
+
}
|
|
6882
|
+
} else {
|
|
6883
|
+
// success
|
|
6884
|
+
profile_picture_source = 'internet search';
|
|
6885
|
+
try {
|
|
6886
|
+
image_blob_ret = await get_image_blob_from_downloaded_image(url);
|
|
6887
|
+
} catch (err) {
|
|
6888
|
+
if (!err.message.includes('Failed to fetch image URL')) {
|
|
6889
|
+
console.error(err);
|
|
6890
|
+
return '';
|
|
6891
|
+
}
|
|
6892
|
+
profile_picture_source = 'factual';
|
|
6893
|
+
factual_image_mode = true;
|
|
6890
6894
|
}
|
|
6891
|
-
profile_picture_source = 'factual';
|
|
6892
|
-
factual_image_mode = true;
|
|
6893
6895
|
}
|
|
6896
|
+
} else {
|
|
6897
|
+
factual_image_mode = true;
|
|
6898
|
+
profile_picture_source = 'factual';
|
|
6894
6899
|
}
|
|
6900
|
+
|
|
6895
6901
|
if (factual_image_mode) {
|
|
6896
6902
|
imageBase64 = await create_image(uid, factual_prompt, undefined, undefined, 1, undefined, undefined, {}, account_profile_info);
|
|
6897
6903
|
} else {
|