@xuda.io/ai_module 1.1.4286 → 1.1.4287

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.
Files changed (2) hide show
  1. package/index.mjs +8 -2
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -6685,7 +6685,7 @@ const attachment_handler = async function (uid, app_id, conversation_id, attachm
6685
6685
  };
6686
6686
 
6687
6687
  export const is_spam_email = async function (uid, email, subject, account_profile_info) {
6688
- const is_spam = await submit_chat_gpt_prompt({
6688
+ const is_spam_ret = await submit_chat_gpt_prompt({
6689
6689
  uid,
6690
6690
  prompt: `detect if the email: ${email} with a subject ${subject} is spam or promotional. return true or false`,
6691
6691
  model: 'gpt-5-nano',
@@ -6695,7 +6695,13 @@ export const is_spam_email = async function (uid, email, subject, account_profil
6695
6695
  metadata: { func: 'is_spam_email' },
6696
6696
  account_profile_info,
6697
6697
  });
6698
- return is_spam;
6698
+
6699
+ try {
6700
+ if (is_spam_ret.code > -1) {
6701
+ const data = JSON.parse(is_spam_ret.data);
6702
+ return data.is_spam;
6703
+ }
6704
+ } catch (error) {}
6699
6705
  };
6700
6706
 
6701
6707
  export const is_business_contact = async function (uid, email, subject, body, account_profile_info) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.4286",
3
+ "version": "1.1.4287",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",