@xuda.io/ai_module 1.1.4514 → 1.1.4515
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 -6
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -4089,16 +4089,17 @@ export const submit_chat_gpt_prompt = async function (req) {
|
|
|
4089
4089
|
return { code: -5, data: err.message };
|
|
4090
4090
|
}
|
|
4091
4091
|
};
|
|
4092
|
+
|
|
4093
|
+
function getFirstNWords(text, n = 10) {
|
|
4094
|
+
// Split on whitespace, keep punctuation attached to words
|
|
4095
|
+
const words = text.match(/\S+/g) || [];
|
|
4096
|
+
return words.slice(0, n).join(' ');
|
|
4097
|
+
}
|
|
4098
|
+
|
|
4092
4099
|
export const create_conversation = async function (req, job_id, headers) {
|
|
4093
4100
|
const { uid, prompt, perform_ai_execution = true, email_id, email_direction = 'out' } = req;
|
|
4094
4101
|
let { reference_type, reference_id = '', conversation_type } = req;
|
|
4095
4102
|
|
|
4096
|
-
function getFirstTenWords(text) {
|
|
4097
|
-
// Split on whitespace, keep punctuation attached to words
|
|
4098
|
-
const words = text.match(/\S+/g) || [];
|
|
4099
|
-
return words.slice(0, 10).join(' ');
|
|
4100
|
-
}
|
|
4101
|
-
|
|
4102
4103
|
const account_profile_info = await account_module.get_active_account_profile_info(uid);
|
|
4103
4104
|
const { account_profile_obj } = account_profile_info;
|
|
4104
4105
|
try {
|