@xuda.io/ai_module 1.1.4309 → 1.1.4311
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 +29 -15
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -5289,7 +5289,7 @@ setTimeout(async () => {
|
|
|
5289
5289
|
// Location: 'https://xuda-bucket-dev.nyc3.digitaloceanspaces.com/dev.xuda.io/user/d39126e0e2c51ffbd1aad10709fc8335/cb7353fc-4788-49b7-8e73-f7f1be108b69_drv_d39126e0e2c51ffbd1aad10709fc8335_b92337f79e090a2f287bc3dc35d0033e.png',
|
|
5290
5290
|
// },
|
|
5291
5291
|
// });
|
|
5292
|
-
ret = await get_business_logo(uid, 'bank of america', account_profile_info);
|
|
5292
|
+
// ret = await get_business_logo(uid, 'bank of america', account_profile_info);
|
|
5293
5293
|
|
|
5294
5294
|
console.log(ret);
|
|
5295
5295
|
}, 1000);
|
|
@@ -6724,21 +6724,35 @@ export const is_business_contact = async function (uid, email, name, subject, bo
|
|
|
6724
6724
|
};
|
|
6725
6725
|
|
|
6726
6726
|
const get_business_logo = async function (uid, name, account_profile_info) {
|
|
6727
|
-
const
|
|
6728
|
-
|
|
6729
|
-
|
|
6730
|
-
|
|
6731
|
-
|
|
6732
|
-
// is_business: z.boolean().describe('true if this is a business account/contact, false otherwise'),
|
|
6733
|
-
// }),
|
|
6734
|
-
metadata: { func: 'get_business_logo' },
|
|
6735
|
-
account_profile_info,
|
|
6736
|
-
tools: [{ type: 'web_search_preview' }],
|
|
6737
|
-
});
|
|
6738
|
-
console.log('=============', ret);
|
|
6727
|
+
const get_url = async function () {
|
|
6728
|
+
const ret = await submit_chat_gpt_prompt({
|
|
6729
|
+
uid,
|
|
6730
|
+
prompt: `find "${name}" icon/logo, Return only png,jpg image url single result e.g: "https://example.com/logo_image.png", nothing else`,
|
|
6731
|
+
model: 'gpt-5-nano',
|
|
6739
6732
|
|
|
6740
|
-
|
|
6741
|
-
|
|
6733
|
+
metadata: { func: 'get_business_logo' },
|
|
6734
|
+
account_profile_info,
|
|
6735
|
+
tools: [{ type: 'web_search_preview' }],
|
|
6736
|
+
});
|
|
6737
|
+
console.log('=============', ret);
|
|
6738
|
+
return ret.data;
|
|
6739
|
+
};
|
|
6740
|
+
|
|
6741
|
+
let url = await get_url();
|
|
6742
|
+
let file;
|
|
6743
|
+
try {
|
|
6744
|
+
file = await return_image_blob_from_downloaded_image(url);
|
|
6745
|
+
} catch (err) {
|
|
6746
|
+
if (!err.message.includes('Failed to fetch image URL')) return console.error(err);
|
|
6747
|
+
|
|
6748
|
+
try {
|
|
6749
|
+
url = await get_url();
|
|
6750
|
+
file = await return_image_blob_from_downloaded_image(url);
|
|
6751
|
+
} catch (err) {
|
|
6752
|
+
return console.error(err);
|
|
6753
|
+
}
|
|
6754
|
+
}
|
|
6755
|
+
// const file = await return_image_blob_from_downloaded_image(url);
|
|
6742
6756
|
// const imageBase64 = Buffer.from(await file.image_blob.arrayBuffer()).toString('base64');
|
|
6743
6757
|
const model = 'chatgpt-image-latest';
|
|
6744
6758
|
const prompt = `
|