@xuda.io/ai_module 1.1.4371 → 1.1.4372
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 +6 -6
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -5674,7 +5674,7 @@ export const create_account_profile_avatar = async function (req, job_id, header
|
|
|
5674
5674
|
}
|
|
5675
5675
|
};
|
|
5676
5676
|
|
|
5677
|
-
export const get_profile_avatar = async function (
|
|
5677
|
+
export const get_profile_avatar = async function (profile_picture, uid, prompt, account_profile_info, account_type, docType = 'account', _id, metadata = {}, business_size = 'unknown', name, email, job_id, headers) {
|
|
5678
5678
|
const tempDir = os.tmpdir();
|
|
5679
5679
|
const uniqueId = Date.now() + '_' + Math.random().toString(36).substring(7);
|
|
5680
5680
|
const tempOutputPath = path.join(tempDir, `output_${uniqueId}.png`);
|
|
@@ -5826,7 +5826,7 @@ export const get_profile_avatar = async function (url, uid, prompt, account_prof
|
|
|
5826
5826
|
// );
|
|
5827
5827
|
|
|
5828
5828
|
let imageBase64;
|
|
5829
|
-
const image_blob_ret = await get_image_blob_from_downloaded_image(
|
|
5829
|
+
const image_blob_ret = await get_image_blob_from_downloaded_image(profile_picture);
|
|
5830
5830
|
let avatar_source = '';
|
|
5831
5831
|
if (prompt) {
|
|
5832
5832
|
const model = 'chatgpt-image-latest';
|
|
@@ -5837,7 +5837,7 @@ export const get_profile_avatar = async function (url, uid, prompt, account_prof
|
|
|
5837
5837
|
background: 'transparent',
|
|
5838
5838
|
});
|
|
5839
5839
|
imageBase64 = ai_avatar_response.data[0].b64_json;
|
|
5840
|
-
record_chat_usage(uid, ai_avatar_response.usage.input_tokens, ai_avatar_response.usage.output_tokens, 'profile avatar', prompt, model, {
|
|
5840
|
+
record_chat_usage(uid, ai_avatar_response.usage.input_tokens, ai_avatar_response.usage.output_tokens, 'profile avatar', prompt, model, { profile_picture }, account_profile_info);
|
|
5841
5841
|
} else {
|
|
5842
5842
|
//////////////////
|
|
5843
5843
|
imageBase64 = Buffer.from(await image_blob_ret.image_blob.arrayBuffer()).toString('base64');
|
|
@@ -5939,7 +5939,7 @@ export const get_profile_avatar = async function (url, uid, prompt, account_prof
|
|
|
5939
5939
|
The background should be fully removed, remove trees,clouds,sky or any landscape objects`,
|
|
5940
5940
|
background: 'transparent',
|
|
5941
5941
|
});
|
|
5942
|
-
record_chat_usage(uid, ai_avatar_response.usage.input_tokens, ai_avatar_response.usage.output_tokens, 'profile avatar', prompt, model, {
|
|
5942
|
+
record_chat_usage(uid, ai_avatar_response.usage.input_tokens, ai_avatar_response.usage.output_tokens, 'profile avatar', prompt, model, { profile_picture }, account_profile_info);
|
|
5943
5943
|
imageBase64 = ai_avatar_response.data[0].b64_json;
|
|
5944
5944
|
avatar_source = 'fictional';
|
|
5945
5945
|
} else {
|
|
@@ -5956,7 +5956,7 @@ export const get_profile_avatar = async function (url, uid, prompt, account_prof
|
|
|
5956
5956
|
Context: ${JSON.stringify({ name, bio, country, mainCategory, subCategory })}`,
|
|
5957
5957
|
background: 'transparent',
|
|
5958
5958
|
});
|
|
5959
|
-
record_chat_usage(uid, ai_avatar_response.usage.input_tokens, ai_avatar_response.usage.output_tokens, 'profile avatar', prompt, model, {
|
|
5959
|
+
record_chat_usage(uid, ai_avatar_response.usage.input_tokens, ai_avatar_response.usage.output_tokens, 'profile avatar', prompt, model, { profile_picture }, account_profile_info);
|
|
5960
5960
|
imageBase64 = ai_avatar_response.data[0].b64_json;
|
|
5961
5961
|
avatar_source = 'ai profile';
|
|
5962
5962
|
};
|
|
@@ -5966,7 +5966,7 @@ export const get_profile_avatar = async function (url, uid, prompt, account_prof
|
|
|
5966
5966
|
const prompt = `analyze the the person info : ${JSON.stringify({ name, bio, country, mainCategory, subCategory })}
|
|
5967
5967
|
and create realistic fictional profile picture transparent background ,person in the center of the picture return only a centered head-and-shoulders portrait facing the camera. include no labels or text add top margin the person should cover the whole picture`;
|
|
5968
5968
|
|
|
5969
|
-
imageBase64 = await create_image(uid, prompt, undefined, undefined, 1, undefined, undefined, { url }, account_profile_info);
|
|
5969
|
+
imageBase64 = await create_image(uid, prompt, undefined, undefined, 1, undefined, undefined, { url: profile_picture }, account_profile_info);
|
|
5970
5970
|
avatar_source = 'fictional';
|
|
5971
5971
|
};
|
|
5972
5972
|
// personal account
|