@xuda.io/ai_module 1.1.3619 → 1.1.3620

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.
Files changed (2) hide show
  1. package/index.mjs +9 -12
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -5763,6 +5763,7 @@ export const create_ai_agent_image = async function (req, job_id, headers) {
5763
5763
  const ai_agent_doc = await db_module.get_app_couch_doc_native(app_id, ai_agent_id);
5764
5764
  const account_doc = await db_module.get_couch_doc_native('xuda_accounts', uid);
5765
5765
  let url = account_doc.account_info.profile_avatar;
5766
+
5766
5767
  try {
5767
5768
  if (!url) {
5768
5769
  throw new Error('No URL provided in request');
@@ -5811,21 +5812,17 @@ export const create_ai_agent_image = async function (req, job_id, headers) {
5811
5812
  //////////////////
5812
5813
  imageBase64 = Buffer.from(await images[0].image_blob.arrayBuffer()).toString('base64');
5813
5814
 
5814
- const create_avatar_from_pic = async function () {
5815
- const { first_name, last_name, bio, country, mainCategory, subCategory } = account_obj.account_info;
5816
- const ai_avatar_response = await client.images.edit({
5817
- model: 'chatgpt-image-latest',
5818
- image: images[0].image_blob,
5815
+ const { first_name, last_name, bio, country, mainCategory, subCategory } = account_obj.account_info;
5816
+ const ai_avatar_response = await client.images.edit({
5817
+ model: 'chatgpt-image-latest',
5818
+ image: images[0].image_blob,
5819
5819
 
5820
- 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.
5820
+ 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.
5821
5821
  Ensure the subject is large enough to fill most of the frame. Use the supplied name, country, and context to guide the character’s appearance.
5822
5822
  Context: ${JSON.stringify({ first_name, last_name, bio, country, mainCategory, subCategory })}`,
5823
- background: 'transparent',
5824
- });
5825
- imageBase64 = ai_avatar_response.data[0].b64_json;
5826
- };
5827
-
5828
- await create_avatar_from_pic();
5823
+ background: 'transparent',
5824
+ });
5825
+ imageBase64 = ai_avatar_response.data[0].b64_json;
5829
5826
 
5830
5827
  console.log('Normalizing final avatar to 1024 with transparent padding...');
5831
5828
  imageBase64 = await normalizeBase64To1024(imageBase64);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.3619",
3
+ "version": "1.1.3620",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",