@xuda.io/ai_module 1.1.3845 → 1.1.3847
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 +5 -4
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -5677,7 +5677,7 @@ export const convert_profile_image_to_avatar = async function (req, job_id, head
|
|
|
5677
5677
|
background: 'transparent',
|
|
5678
5678
|
});
|
|
5679
5679
|
imageBase64 = ai_avatar_response.data[0].b64_json;
|
|
5680
|
-
record_chat_usage(uid, ai_avatar_response.usage.input_tokens, ai_avatar_response.usage.output_tokens, 'profile avatar', prompt, model);
|
|
5680
|
+
record_chat_usage(uid, ai_avatar_response.usage.input_tokens, ai_avatar_response.usage.output_tokens, 'profile avatar', prompt, model, { url });
|
|
5681
5681
|
} else {
|
|
5682
5682
|
//////////////////
|
|
5683
5683
|
imageBase64 = Buffer.from(await images[0].image_blob.arrayBuffer()).toString('base64');
|
|
@@ -5755,7 +5755,7 @@ export const convert_profile_image_to_avatar = async function (req, job_id, head
|
|
|
5755
5755
|
The background should be fully removed, remove trees,clouds,sky or any landscape objects`,
|
|
5756
5756
|
background: 'transparent',
|
|
5757
5757
|
});
|
|
5758
|
-
record_chat_usage(uid, ai_avatar_response.usage.input_tokens, ai_avatar_response.usage.output_tokens, 'profile avatar', prompt, model);
|
|
5758
|
+
record_chat_usage(uid, ai_avatar_response.usage.input_tokens, ai_avatar_response.usage.output_tokens, 'profile avatar', prompt, model, { url });
|
|
5759
5759
|
imageBase64 = ai_avatar_response.data[0].b64_json;
|
|
5760
5760
|
avatar_source = 'fictional';
|
|
5761
5761
|
} else {
|
|
@@ -5772,7 +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
|
+
record_chat_usage(uid, ai_avatar_response.usage.input_tokens, ai_avatar_response.usage.output_tokens, 'profile avatar', prompt, model, { url });
|
|
5776
5776
|
imageBase64 = ai_avatar_response.data[0].b64_json;
|
|
5777
5777
|
avatar_source = 'ai profile';
|
|
5778
5778
|
};
|
|
@@ -6251,7 +6251,7 @@ const create_ai_agent_image = async function (req, job_id, headers) {
|
|
|
6251
6251
|
}
|
|
6252
6252
|
};
|
|
6253
6253
|
|
|
6254
|
-
const record_chat_usage = async function (uid, input_tokens, output_tokens, source, prompt) {
|
|
6254
|
+
const record_chat_usage = async function (uid, input_tokens, output_tokens, source, prompt, metadata) {
|
|
6255
6255
|
try {
|
|
6256
6256
|
const app_id = await account_module.get_account_default_project_id(uid);
|
|
6257
6257
|
|
|
@@ -6266,6 +6266,7 @@ const record_chat_usage = async function (uid, input_tokens, output_tokens, sour
|
|
|
6266
6266
|
input_tokens,
|
|
6267
6267
|
output_tokens,
|
|
6268
6268
|
stat: 3,
|
|
6269
|
+
metadata,
|
|
6269
6270
|
};
|
|
6270
6271
|
const save_ret = await db_module.save_app_couch_doc(app_id, usage_doc);
|
|
6271
6272
|
// console.log(save_ret);
|