@xuda.io/ai_module 1.1.3614 → 1.1.3616

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 +1 -50
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -5758,33 +5758,6 @@ export const create_ai_agent_image = async function (req, job_id, headers) {
5758
5758
  return { is_transparent, image_blob: new Blob([buffer], { type: 'image/png' }) };
5759
5759
  }
5760
5760
 
5761
- const detect_real_person_in_image = async function (base64) {
5762
- const ret = await submit_chat_gpt_prompt({
5763
- model: 'gpt-5-nano',
5764
- prompt: [
5765
- {
5766
- role: 'user',
5767
- content: [
5768
- {
5769
- type: 'input_text',
5770
- text: `detect if a postrate of real person shown in the picture `,
5771
- },
5772
- {
5773
- type: 'input_image',
5774
- image_url: `data:image/png;base64,${base64}`,
5775
- },
5776
- ],
5777
- },
5778
- ],
5779
- response_format: z.object({
5780
- is_real_person_in_picture: z.boolean().describe('if a postrate of real person in the picture return true otherwise return false'),
5781
- }),
5782
- });
5783
-
5784
- const res = JSON5.parse(ret.data);
5785
- return res?.is_real_person_in_picture;
5786
- };
5787
-
5788
5761
  const { url, uid, account_obj, prompt } = req;
5789
5762
 
5790
5763
  try {
@@ -5849,30 +5822,8 @@ export const create_ai_agent_image = async function (req, job_id, headers) {
5849
5822
  imageBase64 = ai_avatar_response.data[0].b64_json;
5850
5823
  avatar_source = 'ai profile';
5851
5824
  };
5852
- const create_fictional_avatar = async function () {
5853
- const { first_name, last_name, bio, country, mainCategory, subCategory } = account_obj.account_info;
5854
-
5855
- const prompt = `analyze the the person info : ${JSON.stringify({ first_name, last_name, bio, country, mainCategory, subCategory })}
5856
- 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`;
5857
5825
 
5858
- imageBase64 = await create_image(prompt, undefined, undefined, 1);
5859
- avatar_source = 'fictional';
5860
- };
5861
- // personal account
5862
- const is_real_person_in_picture = await detect_real_person_in_image(imageBase64);
5863
- if (is_real_person_in_picture) {
5864
- if (images[0].is_transparent) {
5865
- // keep the original
5866
- imageBase64 = Buffer.from(await images[0].image_blob.arrayBuffer()).toString('base64');
5867
- avatar_source = 'authentic profile';
5868
- } else {
5869
- // create avatar from profile picture
5870
- await create_avatar_from_pic();
5871
- }
5872
- } else {
5873
- // create avatar from profile picture
5874
- await create_fictional_avatar();
5875
- }
5826
+ await create_avatar_from_pic();
5876
5827
 
5877
5828
  console.log('Normalizing final avatar to 1024 with transparent padding...');
5878
5829
  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.3614",
3
+ "version": "1.1.3616",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",