@xuda.io/ai_module 1.1.4428 → 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.
Files changed (2) hide show
  1. package/index.mjs +7 -1
  2. 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: prompt.substr(0, 40),
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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.4428",
3
+ "version": "1.1.4430",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",