@xuda.io/ai_module 1.1.4761 → 1.1.4763

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 +7 -4
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -6459,7 +6459,7 @@ const create_ai_agent_image = async function (req, job_id, headers) {
6459
6459
  const tempOutputPath = path.join(tempDir, `output_${uniqueId}.png`);
6460
6460
 
6461
6461
  const { app_id, uid, ai_agent_id, tags } = req;
6462
- const account_profile_info = await get_active_account_profile_info(uid);
6462
+ const account_profile_info = await account_module.get_active_account_profile_info(uid);
6463
6463
  const ai_agent_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, ai_agent_id);
6464
6464
  const account_doc = await db_module.get_couch_doc_native('xuda_accounts', uid);
6465
6465
 
@@ -6512,7 +6512,7 @@ const create_ai_agent_image = async function (req, job_id, headers) {
6512
6512
  imageBase64 = Buffer.from(await image_blob_ret.image_blob.arrayBuffer()).toString('base64');
6513
6513
  // const model = 'chatgpt-image-latest';
6514
6514
  const model = 'gpt-image-1-mini';
6515
- const prompt=`
6515
+ const prompt = `
6516
6516
  Create a futuristic, profile portrait with a transparent background.
6517
6517
  make the character look like the person from the provided image with complete metal face hairless ,
6518
6518
  The humanoid must remain completely metal.
@@ -6533,7 +6533,7 @@ const create_ai_agent_image = async function (req, job_id, headers) {
6533
6533
  - Material finish
6534
6534
  - Light interaction Use advanced or reflective materials to convey intelligence and sophistication.
6535
6535
  The overall composition should symbolize the fusion of human creativity and machine intelligence.
6536
- `
6536
+ `;
6537
6537
  const ai_avatar_response = await client.images.edit({
6538
6538
  model,
6539
6539
  image: image_blob_ret.image_blob,
@@ -6544,7 +6544,10 @@ const create_ai_agent_image = async function (req, job_id, headers) {
6544
6544
  imageBase64 = ai_avatar_response.data[0].b64_json;
6545
6545
  account_module.record_ai_usage(uid, ai_avatar_response.usage.input_tokens, ai_avatar_response.usage.output_tokens, 'agent avatar', prompt, model, { ai_agent_id }, account_profile_info);
6546
6546
  console.log('Normalizing final avatar to 1024 with transparent padding...');
6547
- imageBase64 = await normalizeBase64To1024(imageBase64);
6547
+ imageBase64 = await normalizeBase64To1024(imageBase64, {
6548
+ fit: 'contain', // Preserve aspect ratio, fit within 211x211
6549
+ background: { r: 0, g: 0, b: 0, alpha: 0 }, // Transparent background for padding
6550
+ });
6548
6551
 
6549
6552
  const outputBuffer = Buffer.from(imageBase64, 'base64');
6550
6553
  const outputPath = tempOutputPath;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.4761",
3
+ "version": "1.1.4763",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",