@xuda.io/ai_module 1.1.3613 → 1.1.3615

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 +11 -56
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -5834,68 +5834,23 @@ export const create_ai_agent_image = async function (req, job_id, headers) {
5834
5834
 
5835
5835
  //////////////////
5836
5836
  imageBase64 = Buffer.from(await images[0].image_blob.arrayBuffer()).toString('base64');
5837
- if (account_obj.account_info.account_type === 'business') {
5838
- // create avatar from logo - BUSINESS
5839
- const { bio, business_name, country, mainCategory, subCategory } = account_obj.account_info;
5840
- // const ai_avatar_response = await client.images.edit({
5841
- // model: 'chatgpt-image-latest',
5842
- // image: images[0].image_blob, // only one image allowed
5843
- // prompt: `Generate a realistic fictional portrait wearing a hat. The portrait should be centered, head-and-shoulders only, on a transparent background. Place the provided logo on the hat, and 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.
5844
- // Context: ${JSON.stringify({ bio, business_name, country, mainCategory, subCategory })}`,
5845
- // background: 'transparent',
5846
- // });
5837
+
5838
+ const create_avatar_from_pic = async function () {
5839
+ const { first_name, last_name, bio, country, mainCategory, subCategory } = account_obj.account_info;
5847
5840
  const ai_avatar_response = await client.images.edit({
5848
5841
  model: 'chatgpt-image-latest',
5849
- image: images[0].image_blob, //base photo
5850
- prompt: `Create a transparent PNG profile image for a business account featuring building branded as ${business_name}.
5851
- Display the attached logo clearly as prominent exterior signage.
5852
- The building’s architecture and overall atmosphere should reflect the nature of the business, aligning with ${mainCategory} and ${subCategory}.
5853
- Use the provided bio (${bio}) to understand the company’s focus and personality, and adapt the architectural style to match the ${country} country’s local design language. Select an appropriate building type for the specific business category, and present a contemporary,
5854
- creative office environment with a strong, recognizable brand identity. The background should be fully removed, remove trees,clouds,sky or any landscape objects`,
5855
- background: 'transparent',
5856
- });
5857
- imageBase64 = ai_avatar_response.data[0].b64_json;
5858
- avatar_source = 'fictional';
5859
- } else {
5860
- const create_avatar_from_pic = async function () {
5861
- const { first_name, last_name, bio, country, mainCategory, subCategory } = account_obj.account_info;
5862
- const ai_avatar_response = await client.images.edit({
5863
- model: 'chatgpt-image-latest',
5864
- image: images[0].image_blob,
5842
+ image: images[0].image_blob,
5865
5843
 
5866
- 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.
5844
+ 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.
5867
5845
  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.
5868
5846
  Context: ${JSON.stringify({ first_name, last_name, bio, country, mainCategory, subCategory })}`,
5869
- background: 'transparent',
5870
- });
5871
- imageBase64 = ai_avatar_response.data[0].b64_json;
5872
- avatar_source = 'ai profile';
5873
- };
5874
- const create_fictional_avatar = async function () {
5875
- const { first_name, last_name, bio, country, mainCategory, subCategory } = account_obj.account_info;
5876
-
5877
- const prompt = `analyze the the person info : ${JSON.stringify({ first_name, last_name, bio, country, mainCategory, subCategory })}
5878
- 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`;
5847
+ background: 'transparent',
5848
+ });
5849
+ imageBase64 = ai_avatar_response.data[0].b64_json;
5850
+ avatar_source = 'ai profile';
5851
+ };
5879
5852
 
5880
- imageBase64 = await create_image(prompt, undefined, undefined, 1);
5881
- avatar_source = 'fictional';
5882
- };
5883
- // personal account
5884
- const is_real_person_in_picture = await detect_real_person_in_image(imageBase64);
5885
- if (is_real_person_in_picture) {
5886
- if (images[0].is_transparent) {
5887
- // keep the original
5888
- imageBase64 = Buffer.from(await images[0].image_blob.arrayBuffer()).toString('base64');
5889
- avatar_source = 'authentic profile';
5890
- } else {
5891
- // create avatar from profile picture
5892
- await create_avatar_from_pic();
5893
- }
5894
- } else {
5895
- // create avatar from profile picture
5896
- await create_fictional_avatar();
5897
- }
5898
- }
5853
+ await create_avatar_from_pic();
5899
5854
 
5900
5855
  console.log('Normalizing final avatar to 1024 with transparent padding...');
5901
5856
  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.3613",
3
+ "version": "1.1.3615",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",