@xuda.io/ai_module 1.1.4636 → 1.1.4637
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 +8 -10
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -7214,8 +7214,8 @@ export const categorize_email_subject = async function (uid, subject, account_pr
|
|
|
7214
7214
|
'Confirmation (General)',
|
|
7215
7215
|
'Welcome / Onboarding',
|
|
7216
7216
|
'Follow-up / Reminder',
|
|
7217
|
-
'Miscellaneous / Unclassified'
|
|
7218
|
-
]
|
|
7217
|
+
'Miscellaneous / Unclassified',
|
|
7218
|
+
];
|
|
7219
7219
|
|
|
7220
7220
|
// Create a more detailed prompt with context
|
|
7221
7221
|
const prompt = `Categorize the email subject into one of these exact categories:
|
|
@@ -7246,14 +7246,12 @@ Category:`;
|
|
|
7246
7246
|
|
|
7247
7247
|
if (email_category_ret && email_category_ret.code > -1) {
|
|
7248
7248
|
// Parse the response data
|
|
7249
|
-
const data = typeof email_category_ret.data === 'string'
|
|
7250
|
-
|
|
7251
|
-
: email_category_ret.data; // Fixed variable name (was business_info_ret.data)
|
|
7252
|
-
|
|
7249
|
+
const data = typeof email_category_ret.data === 'string' ? JSON.parse(email_category_ret.data) : email_category_ret.data; // Fixed variable name (was business_info_ret.data)
|
|
7250
|
+
|
|
7253
7251
|
return {
|
|
7254
7252
|
success: true,
|
|
7255
7253
|
category: data.email_category,
|
|
7256
|
-
subject: subject
|
|
7254
|
+
subject: subject,
|
|
7257
7255
|
};
|
|
7258
7256
|
} else {
|
|
7259
7257
|
console.warn('Failed to categorize email subject:', email_category_ret?.message);
|
|
@@ -7261,7 +7259,7 @@ Category:`;
|
|
|
7261
7259
|
success: false,
|
|
7262
7260
|
category: 'Miscellaneous / Unclassified',
|
|
7263
7261
|
subject: subject,
|
|
7264
|
-
error: email_category_ret?.message || 'Unknown error'
|
|
7262
|
+
error: email_category_ret?.message || 'Unknown error',
|
|
7265
7263
|
};
|
|
7266
7264
|
}
|
|
7267
7265
|
} catch (error) {
|
|
@@ -7270,7 +7268,7 @@ Category:`;
|
|
|
7270
7268
|
success: false,
|
|
7271
7269
|
category: 'Miscellaneous / Unclassified',
|
|
7272
7270
|
subject: subject,
|
|
7273
|
-
error: error.message
|
|
7271
|
+
error: error.message,
|
|
7274
7272
|
};
|
|
7275
7273
|
}
|
|
7276
|
-
};
|
|
7274
|
+
};
|