@xuda.io/ai_module 1.1.4658 → 1.1.4660

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 +23 -23
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -4178,7 +4178,6 @@ export const create_conversation = async function (req, job_id, headers) {
4178
4178
  email_direction,
4179
4179
  email_id,
4180
4180
  reference_conversation_id: conversation_obj.id,
4181
-
4182
4181
  account_profiles: [account_profile_obj._id],
4183
4182
  prompt,
4184
4183
  };
@@ -4300,7 +4299,7 @@ export const create_conversation = async function (req, job_id, headers) {
4300
4299
 
4301
4300
  const process_conversation = async function (uid, conversation_id, account_profile_info, job_id, headers) {
4302
4301
  let conversation_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, conversation_id);
4303
- const { conversation_type } = conversation_doc;
4302
+ const { conversation_type, prompt } = conversation_doc;
4304
4303
 
4305
4304
  // Ask GPT for title
4306
4305
  if (conversation_type !== 'email') {
@@ -4314,31 +4313,32 @@ const process_conversation = async function (uid, conversation_id, account_profi
4314
4313
  }
4315
4314
  }
4316
4315
  /// categorize prompt
4317
- let category_info = {};
4318
- switch (conversation_type) {
4319
- case 'ai': {
4320
- category_info = await categorize_ai_prompt(uid, prompt, account_profile_info);
4321
- break;
4322
- }
4316
+ let category_info = { category: 'unknown' };
4317
+ if (prompt?.length > 5)
4318
+ switch (conversation_type) {
4319
+ case 'ai': {
4320
+ category_info = await categorize_ai_prompt(uid, prompt, account_profile_info);
4321
+ break;
4322
+ }
4323
4323
 
4324
- case 'email': {
4325
- category_info = await categorize_email_subject(uid, prompt, account_profile_info);
4326
- break;
4327
- }
4324
+ case 'email': {
4325
+ category_info = await categorize_email_subject(uid, prompt, account_profile_info);
4326
+ break;
4327
+ }
4328
4328
 
4329
- case 'chat': {
4330
- category_info = await categorize_text_message(uid, prompt, account_profile_info);
4331
- break;
4332
- }
4329
+ case 'chat': {
4330
+ category_info = await categorize_text_message(uid, prompt, account_profile_info);
4331
+ break;
4332
+ }
4333
4333
 
4334
- case 'note': {
4335
- category_info = await categorize_contact_note(uid, prompt, account_profile_info);
4336
- break;
4337
- }
4334
+ case 'note': {
4335
+ category_info = await categorize_contact_note(uid, prompt, account_profile_info);
4336
+ break;
4337
+ }
4338
4338
 
4339
- default:
4340
- break;
4341
- }
4339
+ default:
4340
+ break;
4341
+ }
4342
4342
 
4343
4343
  conversation_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, conversation_doc._id);
4344
4344
  contact_doc.category_info = category_info;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.4658",
3
+ "version": "1.1.4660",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",