@xuda.io/ai_module 1.1.3841 → 1.1.3843
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 +4 -3
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -5759,12 +5759,12 @@ export const convert_profile_image_to_avatar = async function (req, job_id, head
|
|
|
5759
5759
|
imageBase64 = ai_avatar_response.data[0].b64_json;
|
|
5760
5760
|
avatar_source = 'fictional';
|
|
5761
5761
|
} else {
|
|
5762
|
-
debugger;
|
|
5763
5762
|
/// PERSONAL
|
|
5764
5763
|
const create_avatar_from_pic = async function () {
|
|
5765
5764
|
const { first_name, last_name, bio, country, mainCategory, subCategory } = account_obj.account_info;
|
|
5765
|
+
const model = 'chatgpt-image-latest';
|
|
5766
5766
|
const ai_avatar_response = await client.images.edit({
|
|
5767
|
-
model
|
|
5767
|
+
model,
|
|
5768
5768
|
image: images[0].image_blob,
|
|
5769
5769
|
|
|
5770
5770
|
prompt: `Completely remove the background, enhance and color-correct the subject, and return only a centered head-and-shoulders portrait facing the camera. Add extra top margin, include no labels or text, and export the result as a clean transparent PNG.
|
|
@@ -5772,6 +5772,7 @@ export const convert_profile_image_to_avatar = async function (req, job_id, head
|
|
|
5772
5772
|
Context: ${JSON.stringify({ first_name, last_name, bio, country, mainCategory, subCategory })}`,
|
|
5773
5773
|
background: 'transparent',
|
|
5774
5774
|
});
|
|
5775
|
+
record_chat_usage(uid, ai_avatar_response.usage.input_tokens, ai_avatar_response.usage.output_tokens, 'profile avatar', prompt, model);
|
|
5775
5776
|
imageBase64 = ai_avatar_response.data[0].b64_json;
|
|
5776
5777
|
avatar_source = 'ai profile';
|
|
5777
5778
|
};
|
|
@@ -6208,7 +6209,7 @@ const create_ai_agent_image = async function (req, job_id, headers) {
|
|
|
6208
6209
|
background: 'transparent',
|
|
6209
6210
|
});
|
|
6210
6211
|
imageBase64 = ai_avatar_response.data[0].b64_json;
|
|
6211
|
-
record_chat_usage(uid, ai_avatar_response.usage.input_tokens, ai_avatar_response.usage.output_tokens, '
|
|
6212
|
+
record_chat_usage(uid, ai_avatar_response.usage.input_tokens, ai_avatar_response.usage.output_tokens, 'agent avatar', prompt, model);
|
|
6212
6213
|
console.log('Normalizing final avatar to 1024 with transparent padding...');
|
|
6213
6214
|
imageBase64 = await normalizeBase64To1024(imageBase64);
|
|
6214
6215
|
|