@xuda.io/ai_module 1.1.4429 → 1.1.4430
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 +7 -1
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -4053,6 +4053,12 @@ export const create_conversation = async function (req, job_id, headers) {
|
|
|
4053
4053
|
const { uid, prompt } = req;
|
|
4054
4054
|
let { reference_type, reference_id = '', conversation_type } = req;
|
|
4055
4055
|
|
|
4056
|
+
function getFirstTenWords(text) {
|
|
4057
|
+
// Split on whitespace, keep punctuation attached to words
|
|
4058
|
+
const words = text.match(/\S+/g) || [];
|
|
4059
|
+
return words.slice(0, 10).join(' ');
|
|
4060
|
+
}
|
|
4061
|
+
|
|
4056
4062
|
const account_profile_info = await account_module.get_active_account_profile_info(uid);
|
|
4057
4063
|
const { account_profile_obj } = account_profile_info;
|
|
4058
4064
|
try {
|
|
@@ -4061,7 +4067,7 @@ export const create_conversation = async function (req, job_id, headers) {
|
|
|
4061
4067
|
let conversation_doc = {
|
|
4062
4068
|
_id: conversation_obj.id,
|
|
4063
4069
|
docType: 'chat_conversation',
|
|
4064
|
-
title: conversation_type !== 'email' ? prompt
|
|
4070
|
+
title: conversation_type !== 'email' ? getFirstTenWords(prompt) : prompt,
|
|
4065
4071
|
date_created_ts: t,
|
|
4066
4072
|
ts: t,
|
|
4067
4073
|
stat: !conversation_type || conversation_type === 'ai' ? 1 : 3,
|