@xuda.io/ai_module 1.1.4780 → 1.1.4782
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 +15 -13
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -6960,6 +6960,7 @@ export const get_profile_picture = async function (uid, account_type = 'business
|
|
|
6960
6960
|
image_blob_ret,
|
|
6961
6961
|
file,
|
|
6962
6962
|
profile_picture_source,
|
|
6963
|
+
drive_ret,
|
|
6963
6964
|
resize = {};
|
|
6964
6965
|
|
|
6965
6966
|
switch (account_type) {
|
|
@@ -7040,6 +7041,7 @@ export const get_profile_picture = async function (uid, account_type = 'business
|
|
|
7040
7041
|
try {
|
|
7041
7042
|
image_blob_ret = await get_image_blob_from_downloaded_image(url);
|
|
7042
7043
|
profile_picture_source = 'google';
|
|
7044
|
+
drive_ret = {};
|
|
7043
7045
|
} catch (err) {
|
|
7044
7046
|
if (!err.message.includes('Failed to fetch image URL')) {
|
|
7045
7047
|
console.error(err);
|
|
@@ -7098,24 +7100,24 @@ export const get_profile_picture = async function (uid, account_type = 'business
|
|
|
7098
7100
|
imageBase64 = await normalizeBase64To1024(image_response.data[0].b64_json, resize);
|
|
7099
7101
|
account_module.record_ai_usage(uid, image_response.usage.input_tokens, image_response.usage.output_tokens, 'profile image', prompt, model, { url }, account_profile_info);
|
|
7100
7102
|
}
|
|
7101
|
-
}
|
|
7102
|
-
const outputBuffer = Buffer.from(imageBase64, 'base64');
|
|
7103
|
-
const outputPath = tempOutputPath;
|
|
7104
|
-
await fs.promises.writeFile(outputPath, outputBuffer);
|
|
7105
7103
|
|
|
7106
|
-
|
|
7104
|
+
const outputBuffer = Buffer.from(imageBase64, 'base64');
|
|
7105
|
+
const outputPath = tempOutputPath;
|
|
7106
|
+
await fs.promises.writeFile(outputPath, outputBuffer);
|
|
7107
7107
|
|
|
7108
|
-
|
|
7108
|
+
console.log('Success! Saved →', outputPath);
|
|
7109
7109
|
|
|
7110
|
-
|
|
7111
|
-
originalname,
|
|
7112
|
-
path: outputPath,
|
|
7113
|
-
mimetype: `image/png`,
|
|
7114
|
-
};
|
|
7110
|
+
console.log(file);
|
|
7115
7111
|
|
|
7116
|
-
|
|
7117
|
-
|
|
7112
|
+
const file_obj = {
|
|
7113
|
+
originalname,
|
|
7114
|
+
path: outputPath,
|
|
7115
|
+
mimetype: `image/png`,
|
|
7116
|
+
};
|
|
7118
7117
|
|
|
7118
|
+
drive_ret = await drive_module.upload_drive_file_user({ uid, path: '/Profile Images' }, job_id, headers, file_obj);
|
|
7119
|
+
drive_ret.profile_picture_source = profile_picture_source;
|
|
7120
|
+
}
|
|
7119
7121
|
return drive_ret;
|
|
7120
7122
|
} catch (err) {
|
|
7121
7123
|
console.error(err);
|