@xuda.io/ai_module 1.1.3840 → 1.1.3842

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 +6 -4
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -5739,9 +5739,9 @@ export const convert_profile_image_to_avatar = async function (req, job_id, head
5739
5739
  'A large group of thirty diverse professional employees, all appearing to be from ${country} (with ethnic features, skin tones, and facial characteristics typical of ${country}), men and women in business attire, standing together smiling in the foreground in front of the building',
5740
5740
  },
5741
5741
  };
5742
-
5742
+ const model = 'chatgpt-image-latest';
5743
5743
  const ai_avatar_response = await client.images.edit({
5744
- model: 'chatgpt-image-latest',
5744
+ model,
5745
5745
  image: images[0].image_blob, //logo
5746
5746
  prompt: `
5747
5747
  Create a transparent PNG profile image for a business account featuring building branded as ${business_name}.
@@ -5755,15 +5755,16 @@ 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
5759
  imageBase64 = ai_avatar_response.data[0].b64_json;
5759
5760
  avatar_source = 'fictional';
5760
5761
  } else {
5761
- debugger;
5762
5762
  /// PERSONAL
5763
5763
  const create_avatar_from_pic = async function () {
5764
5764
  const { first_name, last_name, bio, country, mainCategory, subCategory } = account_obj.account_info;
5765
+ const model = 'chatgpt-image-latest';
5765
5766
  const ai_avatar_response = await client.images.edit({
5766
- model: 'chatgpt-image-latest',
5767
+ model,
5767
5768
  image: images[0].image_blob,
5768
5769
 
5769
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.
@@ -5771,6 +5772,7 @@ export const convert_profile_image_to_avatar = async function (req, job_id, head
5771
5772
  Context: ${JSON.stringify({ first_name, last_name, bio, country, mainCategory, subCategory })}`,
5772
5773
  background: 'transparent',
5773
5774
  });
5775
+ record_chat_usage(uid, ai_avatar_response.usage.input_tokens, ai_avatar_response.usage.output_tokens, 'profile avatar', prompt, model);
5774
5776
  imageBase64 = ai_avatar_response.data[0].b64_json;
5775
5777
  avatar_source = 'ai profile';
5776
5778
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.3840",
3
+ "version": "1.1.3842",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",