@xuda.io/ai_module 1.1.4376 → 1.1.4377
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 +15 -7
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -7102,20 +7102,23 @@ export const get_business_info = async function (uid, name, email, account_profi
|
|
|
7102
7102
|
sub: ['Physical Stores', 'Boutiques', 'Supermarkets', 'Consumer Goods', 'Fashion Retail', 'Home Goods'],
|
|
7103
7103
|
},
|
|
7104
7104
|
];
|
|
7105
|
-
|
|
7105
|
+
// Prepare enums for the model
|
|
7106
7106
|
const categoryNames = categories.map((c) => c.name);
|
|
7107
7107
|
const allSubCategories = categories.flatMap((c) => c.sub);
|
|
7108
7108
|
|
|
7109
7109
|
const business_info_ret = await submit_chat_gpt_prompt({
|
|
7110
7110
|
uid,
|
|
7111
|
-
prompt: `Research the company "${name}" (${email}).
|
|
7112
|
-
|
|
7111
|
+
prompt: `Research the company: "${name}" (${email}).
|
|
7112
|
+
Tasks:
|
|
7113
|
+
1. Identify the company size.
|
|
7114
|
+
2. Select the most accurate Industry Category and Sub-Category from the provided lists.
|
|
7115
|
+
3. Identify the primary country and return its ISO 3166-1 alpha-2 code (e.g., 'US', 'GB', 'IL').`,
|
|
7113
7116
|
model: 'gpt-5-nano',
|
|
7114
7117
|
response_format: z.object({
|
|
7115
7118
|
business_size: z.enum(['unknown', 'small', 'medium', 'large', 'enterprise']),
|
|
7116
|
-
business_category: z.enum(categoryNames)
|
|
7117
|
-
business_sub_category: z.enum(allSubCategories)
|
|
7118
|
-
business_country: z.string().describe(
|
|
7119
|
+
business_category: z.enum(categoryNames),
|
|
7120
|
+
business_sub_category: z.enum(allSubCategories),
|
|
7121
|
+
business_country: z.string().length(2).describe("The 2-letter ISO country code, e.g., 'US'"),
|
|
7119
7122
|
}),
|
|
7120
7123
|
metadata: { func: 'get_business_info' },
|
|
7121
7124
|
account_profile_info,
|
|
@@ -7126,9 +7129,14 @@ export const get_business_info = async function (uid, name, email, account_profi
|
|
|
7126
7129
|
if (business_info_ret.code > -1) {
|
|
7127
7130
|
const data = typeof business_info_ret.data === 'string' ? JSON.parse(business_info_ret.data) : business_info_ret.data;
|
|
7128
7131
|
|
|
7132
|
+
// Ensure the country code is always uppercase
|
|
7133
|
+
if (data.business_country) {
|
|
7134
|
+
data.business_country = data.business_country.toUpperCase();
|
|
7135
|
+
}
|
|
7136
|
+
|
|
7129
7137
|
return data;
|
|
7130
7138
|
}
|
|
7131
7139
|
} catch (error) {
|
|
7132
|
-
console.error('
|
|
7140
|
+
console.error('Error processing business info:', error);
|
|
7133
7141
|
}
|
|
7134
7142
|
};
|