@xuda.io/ai_module 1.1.4334 → 1.1.4335
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 +3 -3
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -6794,14 +6794,14 @@ const get_profile_image = async function (uid, account_type = 'business', name,
|
|
|
6794
6794
|
const prompt = `
|
|
6795
6795
|
extract the logo from the image
|
|
6796
6796
|
`;
|
|
6797
|
-
const
|
|
6797
|
+
const image_response = await client.images.edit({
|
|
6798
6798
|
model,
|
|
6799
6799
|
image: file.image_blob, //logo
|
|
6800
6800
|
prompt,
|
|
6801
6801
|
background: 'transparent',
|
|
6802
6802
|
});
|
|
6803
6803
|
|
|
6804
|
-
let imageBase64 = await normalizeBase64To1024(
|
|
6804
|
+
let imageBase64 = await normalizeBase64To1024(image_response.data[0].b64_json);
|
|
6805
6805
|
|
|
6806
6806
|
const outputBuffer = Buffer.from(imageBase64, 'base64');
|
|
6807
6807
|
const outputPath = file.tempOutputPath;
|
|
@@ -6819,7 +6819,7 @@ const get_profile_image = async function (uid, account_type = 'business', name,
|
|
|
6819
6819
|
|
|
6820
6820
|
const drive_ret = await drive_module.upload_drive_file_user({ uid, path: '/Profile Images' }, job_id, headers, file_obj);
|
|
6821
6821
|
|
|
6822
|
-
record_chat_usage(uid,
|
|
6822
|
+
record_chat_usage(uid, image_response.usage.input_tokens, image_response.usage.output_tokens, 'business logo', prompt, model, { url }, account_profile_info);
|
|
6823
6823
|
|
|
6824
6824
|
return drive_ret;
|
|
6825
6825
|
} catch (err) {
|