@xuda.io/ai_module 1.1.4648 → 1.1.4649

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 +34 -36
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -4225,12 +4225,12 @@ export const create_conversation = async function (req, job_id, headers) {
4225
4225
  break;
4226
4226
  }
4227
4227
 
4228
- case 'email': {
4228
+ case 'email': {
4229
4229
  category_info = await categorize_email_subject(uid, prompt, account_profile_info);
4230
4230
  break;
4231
4231
  }
4232
4232
 
4233
- case 'chat': {
4233
+ case 'chat': {
4234
4234
  category_info = await categorize_text_message(uid, prompt, account_profile_info);
4235
4235
  break;
4236
4236
  }
@@ -4239,8 +4239,8 @@ export const create_conversation = async function (req, job_id, headers) {
4239
4239
  break;
4240
4240
  }
4241
4241
 
4242
- conversation_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, conversation_doc._id);
4243
- await db_module.save_app_couch_doc_native(account_profile_info.app_id, conversation_doc);
4242
+ conversation_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, conversation_doc._id);
4243
+ await db_module.save_app_couch_doc_native(account_profile_info.app_id, conversation_doc);
4244
4244
 
4245
4245
  if (perform_ai_execution) {
4246
4246
  // await update_thumbnail('conversation', conversation_doc, account_profile_info.app_id, uid, job_id, headers, null, null, account_profile_info);
@@ -7797,7 +7797,7 @@ export const categorize_text_message = async function (uid, text_message, accoun
7797
7797
  'Forgiveness Request',
7798
7798
  'Miss You Message',
7799
7799
  'Thinking of You',
7800
-
7800
+
7801
7801
  // Practical & Logistics (21-40)
7802
7802
  'Meeting Coordination',
7803
7803
  'Plans Making',
@@ -7819,7 +7819,7 @@ export const categorize_text_message = async function (uid, text_message, accoun
7819
7819
  'Follow-up Request',
7820
7820
  'Confirmation Needed',
7821
7821
  'Status Update',
7822
-
7822
+
7823
7823
  // Information Exchange (41-60)
7824
7824
  'Question Asking',
7825
7825
  'Information Request',
@@ -7841,7 +7841,7 @@ export const categorize_text_message = async function (uid, text_message, accoun
7841
7841
  'Book/Movie Recommendation',
7842
7842
  'Music Recommendation',
7843
7843
  'Restaurant Suggestion',
7844
-
7844
+
7845
7845
  // Work & Business (61-75)
7846
7846
  'Work Discussion',
7847
7847
  'Project Update',
@@ -7858,7 +7858,7 @@ export const categorize_text_message = async function (uid, text_message, accoun
7858
7858
  'Partnership Discussion',
7859
7859
  'Contract Details',
7860
7860
  'Payment Discussion',
7861
-
7861
+
7862
7862
  // Urgent & Emergency (76-85)
7863
7863
  'Emergency Alert',
7864
7864
  'Help Request',
@@ -7870,7 +7870,7 @@ export const categorize_text_message = async function (uid, text_message, accoun
7870
7870
  'Security Concern',
7871
7871
  'Immediate Response Needed',
7872
7872
  'Critical Update',
7873
-
7873
+
7874
7874
  // Social & Invitations (86-95)
7875
7875
  'Event Invitation',
7876
7876
  'Party Invite',
@@ -7882,7 +7882,7 @@ export const categorize_text_message = async function (uid, text_message, accoun
7882
7882
  'Hangout Request',
7883
7883
  'Social Media Tag',
7884
7884
  'Group Chat Add',
7885
-
7885
+
7886
7886
  // Shopping & Commerce (96-105)
7887
7887
  'Purchase Inquiry',
7888
7888
  'Product Question',
@@ -7894,7 +7894,7 @@ export const categorize_text_message = async function (uid, text_message, accoun
7894
7894
  'Payment Request',
7895
7895
  'Bill Splitting',
7896
7896
  'Money Transfer',
7897
-
7897
+
7898
7898
  // Health & Wellness (106-115)
7899
7899
  'Health Update',
7900
7900
  'Doctor Appointment',
@@ -7906,7 +7906,7 @@ export const categorize_text_message = async function (uid, text_message, accoun
7906
7906
  'Self-care Reminder',
7907
7907
  'Recovery Update',
7908
7908
  'Health Advice',
7909
-
7909
+
7910
7910
  // Household & Family (116-125)
7911
7911
  'Family Planning',
7912
7912
  'Childcare Coordination',
@@ -7918,7 +7918,7 @@ export const categorize_text_message = async function (uid, text_message, accoun
7918
7918
  'Property Discussion',
7919
7919
  'Neighbor Communication',
7920
7920
  'Community Update',
7921
-
7921
+
7922
7922
  // Education & Learning (126-135)
7923
7923
  'Homework Help',
7924
7924
  'Study Group',
@@ -7930,7 +7930,7 @@ export const categorize_text_message = async function (uid, text_message, accoun
7930
7930
  'Educational Resource',
7931
7931
  'Learning Progress',
7932
7932
  'Academic Achievement',
7933
-
7933
+
7934
7934
  // Entertainment & Leisure (136-145)
7935
7935
  'Game Invitation',
7936
7936
  'Streaming Watch Party',
@@ -7942,7 +7942,7 @@ export const categorize_text_message = async function (uid, text_message, accoun
7942
7942
  'Adventure Plan',
7943
7943
  'Outdoor Activity',
7944
7944
  'Cultural Event',
7945
-
7945
+
7946
7946
  // Technology & Digital (146-155)
7947
7947
  'Tech Support',
7948
7948
  'App Recommendation',
@@ -7954,21 +7954,21 @@ export const categorize_text_message = async function (uid, text_message, accoun
7954
7954
  'Social Media Tagging',
7955
7955
  'Online Purchase',
7956
7956
  'Digital Content Share',
7957
-
7957
+
7958
7958
  // Legal & Official (156-160)
7959
7959
  'Legal Advice',
7960
7960
  'Document Request',
7961
7961
  'Official Notification',
7962
7962
  'Government Matter',
7963
7963
  'Compliance Issue',
7964
-
7964
+
7965
7965
  // Spiritual & Religious (161-165)
7966
7966
  'Prayer Request',
7967
7967
  'Religious Event',
7968
7968
  'Spiritual Guidance',
7969
7969
  'Meditation Group',
7970
7970
  'Faith Discussion',
7971
-
7971
+
7972
7972
  // Miscellaneous (166-175)
7973
7973
  'Random Thought',
7974
7974
  'Philosophical Question',
@@ -7980,7 +7980,7 @@ export const categorize_text_message = async function (uid, text_message, accoun
7980
7980
  'Goal Setting',
7981
7981
  'Life Update',
7982
7982
  'General Chat',
7983
-
7983
+
7984
7984
  // Signal & Meta Communication (176-185)
7985
7985
  'Read Receipt',
7986
7986
  'Typing Indicator',
@@ -7992,7 +7992,7 @@ export const categorize_text_message = async function (uid, text_message, accoun
7992
7992
  'Network Issue',
7993
7993
  'Delivery Failure',
7994
7994
  'Message Forward',
7995
-
7995
+
7996
7996
  // Relationship Dynamics (186-195)
7997
7997
  'Conflict Resolution',
7998
7998
  'Relationship Discussion',
@@ -8004,14 +8004,14 @@ export const categorize_text_message = async function (uid, text_message, accoun
8004
8004
  'Meeting Planning',
8005
8005
  'Relationship Milestone',
8006
8006
  'Breakup Discussion',
8007
-
8007
+
8008
8008
  // Quick & Brief (196-200)
8009
8009
  'One-word Response',
8010
8010
  'Emoji Message',
8011
8011
  'Sticker/GIF Send',
8012
8012
  'Quick Reply',
8013
- 'Acknowledgment Only'
8014
- ] as const;
8013
+ 'Acknowledgment Only',
8014
+ ];
8015
8015
 
8016
8016
  const prompt = `Categorize this text message into one of the 200 message categories based only on the message content.
8017
8017
 
@@ -8044,22 +8044,20 @@ Category:`;
8044
8044
  emotional_tone: z.enum(['Positive', 'Neutral', 'Negative', 'Urgent', 'Playful', 'Formal', 'Casual', 'Mixed']),
8045
8045
  urgency_level: z.enum(['None', 'Low', 'Medium', 'High', 'Emergency']),
8046
8046
  }),
8047
- metadata: {
8048
- func: 'categorize_text_message',
8047
+ metadata: {
8048
+ func: 'categorize_text_message',
8049
8049
  message_length: text_message.length,
8050
- timestamp: new Date().toISOString()
8050
+ timestamp: new Date().toISOString(),
8051
8051
  },
8052
8052
  account_profile_info, // Still passed to submit_chat_gpt_prompt but not used for context
8053
8053
  });
8054
8054
 
8055
8055
  if (message_category_ret && message_category_ret.code > -1) {
8056
- const data = typeof message_category_ret.data === 'string'
8057
- ? JSON.parse(message_category_ret.data)
8058
- : message_category_ret.data;
8059
-
8056
+ const data = typeof message_category_ret.data === 'string' ? JSON.parse(message_category_ret.data) : message_category_ret.data;
8057
+
8060
8058
  // Simple local analysis
8061
8059
  const message_analysis = {
8062
- word_count: text_message.split(/\s+/).filter(w => w.length > 0).length,
8060
+ word_count: text_message.split(/\s+/).filter((w) => w.length > 0).length,
8063
8061
  char_count: text_message.length,
8064
8062
  has_question: /[?]|(can you|could you|would you|how|what|when|where|why|who)/i.test(text_message),
8065
8063
  has_request: /(please|can you|could you|would you|help|need|want)/i.test(text_message),
@@ -8081,13 +8079,13 @@ Category:`;
8081
8079
  emotional_tone: data.emotional_tone,
8082
8080
  urgency: data.urgency_level,
8083
8081
  priority: priority,
8084
-
8082
+
8085
8083
  // Basic message analysis
8086
8084
  word_count: message_analysis.word_count,
8087
8085
  char_count: message_analysis.char_count,
8088
8086
  has_question: message_analysis.has_question,
8089
8087
  has_request: message_analysis.has_request,
8090
-
8088
+
8091
8089
  // Metadata
8092
8090
  timestamp: new Date().toISOString(),
8093
8091
  message_preview: text_message.substring(0, 100) + (text_message.length > 100 ? '...' : ''),
@@ -8103,7 +8101,7 @@ Category:`;
8103
8101
  priority: 5,
8104
8102
  message_preview: text_message.substring(0, 100),
8105
8103
  error: message_category_ret?.message || 'API call failed',
8106
- timestamp: new Date().toISOString()
8104
+ timestamp: new Date().toISOString(),
8107
8105
  };
8108
8106
  }
8109
8107
  } catch (error) {
@@ -8118,7 +8116,7 @@ Category:`;
8118
8116
  priority: 5,
8119
8117
  message_preview: text_message.substring(0, 100),
8120
8118
  error: error.message,
8121
- timestamp: new Date().toISOString()
8119
+ timestamp: new Date().toISOString(),
8122
8120
  };
8123
8121
  }
8124
- };
8122
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.4648",
3
+ "version": "1.1.4649",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",