@xuda.io/ai_module 1.1.4659 → 1.1.4661
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 +22 -21
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -4313,32 +4313,33 @@ const process_conversation = async function (uid, conversation_id, account_profi
|
|
|
4313
4313
|
}
|
|
4314
4314
|
}
|
|
4315
4315
|
/// categorize prompt
|
|
4316
|
-
let category_info = {};
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
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
|
+
}
|
|
4322
4323
|
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4324
|
+
case 'email': {
|
|
4325
|
+
category_info = await categorize_email_subject(uid, prompt, account_profile_info);
|
|
4326
|
+
break;
|
|
4327
|
+
}
|
|
4327
4328
|
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4329
|
+
case 'chat': {
|
|
4330
|
+
category_info = await categorize_text_message(uid, prompt, account_profile_info);
|
|
4331
|
+
break;
|
|
4332
|
+
}
|
|
4332
4333
|
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4334
|
+
case 'note': {
|
|
4335
|
+
category_info = await categorize_contact_note(uid, prompt, account_profile_info);
|
|
4336
|
+
break;
|
|
4337
|
+
}
|
|
4337
4338
|
|
|
4338
|
-
|
|
4339
|
-
|
|
4339
|
+
default:
|
|
4340
|
+
break;
|
|
4341
|
+
}
|
|
4340
4342
|
}
|
|
4341
|
-
|
|
4342
4343
|
conversation_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, conversation_doc._id);
|
|
4343
4344
|
contact_doc.category_info = category_info;
|
|
4344
4345
|
await db_module.save_app_couch_doc_native(account_profile_info.app_id, conversation_doc);
|