@xuda.io/ai_module 1.1.4648 → 1.1.4650

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