@xuda.io/ai_module 1.1.4516 → 1.1.4517
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 -5
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -4097,7 +4097,7 @@ function getFirstNWords(text, n = 10) {
|
|
|
4097
4097
|
}
|
|
4098
4098
|
|
|
4099
4099
|
export const create_conversation = async function (req, job_id, headers) {
|
|
4100
|
-
const { uid, prompt, perform_ai_execution = true, email_id, email_direction = 'out' } = req;
|
|
4100
|
+
const { uid, prompt, perform_ai_execution = true, email_id, email_direction = 'out', from_mailbox } = req;
|
|
4101
4101
|
let { reference_type, reference_id = '', conversation_type } = req;
|
|
4102
4102
|
|
|
4103
4103
|
const account_profile_info = await account_module.get_active_account_profile_info(uid);
|
|
@@ -4164,12 +4164,14 @@ export const create_conversation = async function (req, job_id, headers) {
|
|
|
4164
4164
|
setTimeout(async () => {
|
|
4165
4165
|
// Ask GPT for title
|
|
4166
4166
|
if (conversation_type !== 'email') {
|
|
4167
|
-
|
|
4167
|
+
if (prompt.split(' ').length > 10) {
|
|
4168
|
+
const title = await submit_chat_gpt_prompt({ uid, prompt: `create title for the prompt return 5 words result maximum text only without options : ${prompt}`, model: 'gpt-5-nano', metadata: { conversation_id: conversation_doc._id, func: 'create_conversation' }, account_profile_info });
|
|
4168
4169
|
|
|
4169
|
-
|
|
4170
|
-
|
|
4170
|
+
conversation_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, conversation_obj.id);
|
|
4171
|
+
conversation_doc.title = title.data;
|
|
4171
4172
|
|
|
4172
|
-
|
|
4173
|
+
await db_module.save_app_couch_doc_native(account_profile_info.app_id, conversation_doc);
|
|
4174
|
+
}
|
|
4173
4175
|
}
|
|
4174
4176
|
if (perform_ai_execution) {
|
|
4175
4177
|
await update_thumbnail('conversation', conversation_doc, account_profile_info.app_id, uid, job_id, headers, null, null, account_profile_info);
|