@xuda.io/ai_module 1.1.4634 → 1.1.4635
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 +2 -11
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -7164,8 +7164,6 @@ export const get_name_from_email_addr = async function (uid, email, account_prof
|
|
|
7164
7164
|
|
|
7165
7165
|
export const categorize_email_subject = async function (uid, subject, account_profile_info) {
|
|
7166
7166
|
const email_categories = [];
|
|
7167
|
-
const categoryNames = categories.map((c) => c.name);
|
|
7168
|
-
const allSubCategories = categories.flatMap((c) => c.sub);
|
|
7169
7167
|
|
|
7170
7168
|
const email_category_ret = await submit_chat_gpt_prompt({
|
|
7171
7169
|
uid,
|
|
@@ -7180,15 +7178,8 @@ export const categorize_email_subject = async function (uid, subject, account_pr
|
|
|
7180
7178
|
});
|
|
7181
7179
|
|
|
7182
7180
|
try {
|
|
7183
|
-
if (
|
|
7184
|
-
const data = typeof
|
|
7185
|
-
|
|
7186
|
-
// Standardize country to uppercase
|
|
7187
|
-
if (data.business_country) data.business_country = data.business_country.toUpperCase();
|
|
7188
|
-
|
|
7189
|
-
// Logic to attach the ID for your database
|
|
7190
|
-
const matched = categories.find((c) => c.name === data.business_category);
|
|
7191
|
-
data.business_category_id = matched ? matched.id : null;
|
|
7181
|
+
if (email_category_ret.code > -1) {
|
|
7182
|
+
const data = typeof email_category_ret.data === 'string' ? JSON.parse(email_category_ret.data) : business_info_ret.data;
|
|
7192
7183
|
|
|
7193
7184
|
return data;
|
|
7194
7185
|
}
|