@xuda.io/ai_module 1.1.4357 → 1.1.4359
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.
- package/index.mjs +51 -16
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -5290,8 +5290,8 @@ setTimeout(async () => {
|
|
|
5290
5290
|
// },
|
|
5291
5291
|
// });
|
|
5292
5292
|
|
|
5293
|
-
// ret = await
|
|
5294
|
-
// ret = await
|
|
5293
|
+
// ret = await get_profile_picture(uid, 'business', 'ioshka media', {}, account_profile_info);
|
|
5294
|
+
// ret = await get_profile_picture(
|
|
5295
5295
|
// uid,
|
|
5296
5296
|
// 'personal',
|
|
5297
5297
|
// 'Glenn Willett',
|
|
@@ -5679,6 +5679,8 @@ export const create_profile_avatar = async function (req, job_id, headers) {
|
|
|
5679
5679
|
const uniqueId = Date.now() + '_' + Math.random().toString(36).substring(7);
|
|
5680
5680
|
const tempOutputPath = path.join(tempDir, `output_${uniqueId}.png`);
|
|
5681
5681
|
|
|
5682
|
+
const { url, uid, account_obj, prompt, is_profile_avatar, account_profile_info, docType = 'account', _id, metadata = {}, profile_picture, business_size = 'unknown' } = req;
|
|
5683
|
+
|
|
5682
5684
|
// async function normalizeBase64To1024(base64Image) {
|
|
5683
5685
|
// const inputBuffer = Buffer.from(base64Image, 'base64');
|
|
5684
5686
|
|
|
@@ -5777,10 +5779,10 @@ export const create_profile_avatar = async function (req, job_id, headers) {
|
|
|
5777
5779
|
};
|
|
5778
5780
|
|
|
5779
5781
|
// const drive_module = await import(`${module_path}/drive_module/index.mjs`);
|
|
5780
|
-
|
|
5781
|
-
if (!is_profile_avatar) {
|
|
5782
|
-
|
|
5783
|
-
}
|
|
5782
|
+
|
|
5783
|
+
// if (!is_profile_avatar) {
|
|
5784
|
+
// await update_profile_avatar_status(account_obj._id, 2);
|
|
5785
|
+
// }
|
|
5784
5786
|
try {
|
|
5785
5787
|
// if (!url) {
|
|
5786
5788
|
// throw new Error('No URL provided in request');
|
|
@@ -5841,7 +5843,7 @@ export const create_profile_avatar = async function (req, job_id, headers) {
|
|
|
5841
5843
|
imageBase64 = Buffer.from(await image_blob_ret.image_blob.arrayBuffer()).toString('base64');
|
|
5842
5844
|
if (account_obj.account_info.account_type === 'business') {
|
|
5843
5845
|
// create avatar from logo - BUSINESS
|
|
5844
|
-
const { bio, business_name, country, mainCategory, subCategory } =
|
|
5846
|
+
const { bio, business_name, country, mainCategory, subCategory, membership_plan } = metadata;
|
|
5845
5847
|
// const ai_avatar_response = await client.images.edit({
|
|
5846
5848
|
// model: 'chatgpt-image-latest',
|
|
5847
5849
|
// image: image_blob_ret.image_blob, // only one image allowed
|
|
@@ -5862,11 +5864,44 @@ export const create_profile_avatar = async function (req, job_id, headers) {
|
|
|
5862
5864
|
// });
|
|
5863
5865
|
/////////////////
|
|
5864
5866
|
|
|
5867
|
+
// const obj = {
|
|
5868
|
+
// free: {
|
|
5869
|
+
// building_size: 'small single-story office building',
|
|
5870
|
+
// employees: 'Empty exterior with no people or employees visible',
|
|
5871
|
+
// },
|
|
5872
|
+
// pro: {
|
|
5873
|
+
// building_size: 'small low-rise single-story office building',
|
|
5874
|
+
// employees: 'One professional employee from ${country} (with ethnic features typical of ${country}) standing prominently in the foreground in front of the building entrance',
|
|
5875
|
+
// },
|
|
5876
|
+
// team: {
|
|
5877
|
+
// building_size: 'medium-sized building',
|
|
5878
|
+
// employees:
|
|
5879
|
+
// 'A small group of five 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',
|
|
5880
|
+
// },
|
|
5881
|
+
// agency: {
|
|
5882
|
+
// building_size: 'medium-sized building',
|
|
5883
|
+
// employees: 'A group of ten 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',
|
|
5884
|
+
// },
|
|
5885
|
+
|
|
5886
|
+
// enterprise_t1: {
|
|
5887
|
+
// building_size: 'large modern multi-story office building',
|
|
5888
|
+
// employees:
|
|
5889
|
+
// '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',
|
|
5890
|
+
// },
|
|
5891
|
+
// enterprise_t2: {
|
|
5892
|
+
// building_size: 'large modern hight tower multi-story office building',
|
|
5893
|
+
// employees:
|
|
5894
|
+
// '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',
|
|
5895
|
+
// },
|
|
5896
|
+
// enterprise_t3: {
|
|
5897
|
+
// building_size: 'large modern hight tower multi-story office building',
|
|
5898
|
+
// employees:
|
|
5899
|
+
// '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',
|
|
5900
|
+
// },
|
|
5901
|
+
// };
|
|
5865
5902
|
const obj = {
|
|
5866
|
-
|
|
5867
|
-
|
|
5868
|
-
employees: 'Empty exterior with no people or employees visible',
|
|
5869
|
-
},
|
|
5903
|
+
unknown: 'small single-story office building',
|
|
5904
|
+
|
|
5870
5905
|
pro: {
|
|
5871
5906
|
building_size: 'small low-rise single-story office building',
|
|
5872
5907
|
employees: 'One professional employee from ${country} (with ethnic features typical of ${country}) standing prominently in the foreground in front of the building entrance',
|
|
@@ -5887,12 +5922,12 @@ export const create_profile_avatar = async function (req, job_id, headers) {
|
|
|
5887
5922
|
'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',
|
|
5888
5923
|
},
|
|
5889
5924
|
enterprise_t2: {
|
|
5890
|
-
building_size: 'large modern multi-story office building',
|
|
5925
|
+
building_size: 'large modern hight tower multi-story office building',
|
|
5891
5926
|
employees:
|
|
5892
5927
|
'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',
|
|
5893
5928
|
},
|
|
5894
5929
|
enterprise_t3: {
|
|
5895
|
-
building_size: 'large modern multi-story office building',
|
|
5930
|
+
building_size: 'large modern hight tower multi-story office building',
|
|
5896
5931
|
employees:
|
|
5897
5932
|
'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',
|
|
5898
5933
|
},
|
|
@@ -5904,7 +5939,7 @@ export const create_profile_avatar = async function (req, job_id, headers) {
|
|
|
5904
5939
|
prompt: `
|
|
5905
5940
|
Create a transparent PNG profile image for a business account featuring building branded as ${business_name}.
|
|
5906
5941
|
Display the attached logo clearly as prominent exterior signage.
|
|
5907
|
-
Show ${obj?.[
|
|
5942
|
+
Show ${obj?.[membership_plan]?.employees || obj.free.employees} in front of the building/premises.
|
|
5908
5943
|
show ${obj?.[account_obj.membership_plan]?.building_size || obj.free.building_size}
|
|
5909
5944
|
The building’s architecture and overall atmosphere should reflect the nature of the business,
|
|
5910
5945
|
aligning with ${mainCategory} and ${subCategory}.
|
|
@@ -6743,7 +6778,7 @@ export const is_business_contact = async function (uid, email, name, subject, bo
|
|
|
6743
6778
|
} catch (error) {}
|
|
6744
6779
|
};
|
|
6745
6780
|
|
|
6746
|
-
const
|
|
6781
|
+
export const get_profile_picture = async function (uid, account_type = 'business', name, facts = {}, account_profile_info, job_id, headers) {
|
|
6747
6782
|
const tempDir = os.tmpdir();
|
|
6748
6783
|
const uniqueId = Date.now() + '_' + Math.random().toString(36).substring(7);
|
|
6749
6784
|
const tempOutputPath = path.join(tempDir, `output_${uniqueId}.png`);
|
|
@@ -6786,7 +6821,7 @@ const get_profile_image = async function (uid, account_type = 'business', name,
|
|
|
6786
6821
|
uid,
|
|
6787
6822
|
prompt,
|
|
6788
6823
|
model: 'gpt-5-nano',
|
|
6789
|
-
metadata: { func: '
|
|
6824
|
+
metadata: { func: 'get_profile_picture' },
|
|
6790
6825
|
account_profile_info,
|
|
6791
6826
|
tools: [{ type: 'web_search_preview' }],
|
|
6792
6827
|
});
|