@xuda.io/ai_module 1.1.4633 → 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 +26 -0
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -7161,3 +7161,29 @@ export const get_name_from_email_addr = async function (uid, email, account_prof
|
|
|
7161
7161
|
console.error('Error in get_name_from_email_addr:', error);
|
|
7162
7162
|
}
|
|
7163
7163
|
};
|
|
7164
|
+
|
|
7165
|
+
export const categorize_email_subject = async function (uid, subject, account_profile_info) {
|
|
7166
|
+
const email_categories = [];
|
|
7167
|
+
|
|
7168
|
+
const email_category_ret = await submit_chat_gpt_prompt({
|
|
7169
|
+
uid,
|
|
7170
|
+
prompt: `categorize the email subject: "${subject}".
|
|
7171
|
+
`,
|
|
7172
|
+
model: 'gpt-5-nano',
|
|
7173
|
+
response_format: z.object({
|
|
7174
|
+
email_category: z.enum(email_categories),
|
|
7175
|
+
}),
|
|
7176
|
+
metadata: { func: 'categorize_email_subject' },
|
|
7177
|
+
account_profile_info,
|
|
7178
|
+
});
|
|
7179
|
+
|
|
7180
|
+
try {
|
|
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;
|
|
7183
|
+
|
|
7184
|
+
return data;
|
|
7185
|
+
}
|
|
7186
|
+
} catch (error) {
|
|
7187
|
+
console.error('Error in get_business_info:', error);
|
|
7188
|
+
}
|
|
7189
|
+
};
|