@xuda.io/ai_module 1.1.4794 → 1.1.4795
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 +1 -81
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -4209,6 +4209,7 @@ export const create_conversation = async function (req, job_id, headers) {
|
|
|
4209
4209
|
account_profiles: [account_profile_obj._id],
|
|
4210
4210
|
prompt,
|
|
4211
4211
|
rtl: _common.detectRTL(prompt),
|
|
4212
|
+
process_stat: perform_ai_execution ? '' : '',
|
|
4212
4213
|
};
|
|
4213
4214
|
const save_ret = await db_module.save_app_couch_doc(account_profile_info.app_id, conversation_doc);
|
|
4214
4215
|
|
|
@@ -4238,87 +4239,6 @@ export const create_conversation = async function (req, job_id, headers) {
|
|
|
4238
4239
|
if (perform_ai_execution) {
|
|
4239
4240
|
await process_conversation(uid, conversation_doc._id, account_profile_info, job_id, headers);
|
|
4240
4241
|
}
|
|
4241
|
-
// // Ask GPT for title
|
|
4242
|
-
// if (conversation_type !== 'email') {
|
|
4243
|
-
// if (prompt.split(' ').length > 10) {
|
|
4244
|
-
// 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 });
|
|
4245
|
-
|
|
4246
|
-
// conversation_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, conversation_doc._id);
|
|
4247
|
-
// conversation_doc.title = title.data;
|
|
4248
|
-
|
|
4249
|
-
// await db_module.save_app_couch_doc_native(account_profile_info.app_id, conversation_doc);
|
|
4250
|
-
// }
|
|
4251
|
-
// }
|
|
4252
|
-
// /// categorize prompt
|
|
4253
|
-
// let category_info = {};
|
|
4254
|
-
// switch (conversation_type) {
|
|
4255
|
-
// case 'ai': {
|
|
4256
|
-
// category_info = await categorize_ai_prompt(uid, prompt, account_profile_info);
|
|
4257
|
-
// break;
|
|
4258
|
-
// }
|
|
4259
|
-
|
|
4260
|
-
// case 'email': {
|
|
4261
|
-
// category_info = await categorize_email_subject(uid, prompt, account_profile_info);
|
|
4262
|
-
// break;
|
|
4263
|
-
// }
|
|
4264
|
-
|
|
4265
|
-
// case 'chat': {
|
|
4266
|
-
// category_info = await categorize_text_message(uid, prompt, account_profile_info);
|
|
4267
|
-
// break;
|
|
4268
|
-
// }
|
|
4269
|
-
|
|
4270
|
-
// case 'note': {
|
|
4271
|
-
// category_info = await categorize_contact_note(uid, prompt, account_profile_info);
|
|
4272
|
-
// break;
|
|
4273
|
-
// }
|
|
4274
|
-
|
|
4275
|
-
// default:
|
|
4276
|
-
// break;
|
|
4277
|
-
// }
|
|
4278
|
-
|
|
4279
|
-
// conversation_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, conversation_doc._id);
|
|
4280
|
-
// contact_doc.category_info = category_info;
|
|
4281
|
-
// await db_module.save_app_couch_doc_native(account_profile_info.app_id, conversation_doc);
|
|
4282
|
-
|
|
4283
|
-
// if (perform_ai_execution) {
|
|
4284
|
-
// // await update_thumbnail('conversation', conversation_doc, account_profile_info.app_id, uid, job_id, headers, null, null, account_profile_info);
|
|
4285
|
-
// }
|
|
4286
|
-
// if (conversation_doc.reference_type === 'contacts') {
|
|
4287
|
-
// if (recipient_uid) {
|
|
4288
|
-
// // valid for chat conversation
|
|
4289
|
-
// // write conversation to host after thumbnail update
|
|
4290
|
-
// // get sender conversation
|
|
4291
|
-
|
|
4292
|
-
// const conversation_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, conversation_doc._id);
|
|
4293
|
-
|
|
4294
|
-
// const recipient_account_profile_info = await ac3180count_module.get_active_account_profile_info(recipient_uid);
|
|
4295
|
-
// let recipient_conversation_doc = await db_module.get_app_couch_doc_native(recipient_account_profile_info.app_id, conversation_doc._id);
|
|
4296
|
-
// recipient_conversation_doc.title = conversation_doc.title;
|
|
4297
|
-
|
|
4298
|
-
// recipient_conversation_doc.thumbnail_request_ts = conversation_doc.thumbnail_request_ts;
|
|
4299
|
-
// recipient_conversation_doc.chat_image = conversation_doc.chat_image;
|
|
4300
|
-
// await db_module.save_app_couch_doc_native(recipient_account_profile_info.app_id, recipient_conversation_doc);
|
|
4301
|
-
|
|
4302
|
-
// await update_conversation_mood_level(
|
|
4303
|
-
// uid,
|
|
4304
|
-
// [
|
|
4305
|
-
// { uid: account_profile_info.uid, contact_id: reference_id },
|
|
4306
|
-
// { uid: recipient_uid, contact_id: recipient_contact_id },
|
|
4307
|
-
// ],
|
|
4308
|
-
// conversation_doc._id,
|
|
4309
|
-
// prompt,
|
|
4310
|
-
// uid,
|
|
4311
|
-
// recipient_uid,
|
|
4312
|
-
// true,
|
|
4313
|
-
// account_profile_info,
|
|
4314
|
-
// );
|
|
4315
|
-
// } else {
|
|
4316
|
-
// // other cases rather then chat
|
|
4317
|
-
// if (perform_ai_execution) {
|
|
4318
|
-
// await update_conversation_mood_level(uid, [{ uid: account_profile_info.uid, contact_id: reference_id }], conversation_doc._id, prompt, null, contact_id, conversation_doc.reference_type === 'contacts', account_profile_info);
|
|
4319
|
-
// }
|
|
4320
|
-
// }
|
|
4321
|
-
// }
|
|
4322
4242
|
|
|
4323
4243
|
if (conversation_doc.reference_type === 'contacts') {
|
|
4324
4244
|
if (recipient_uid) {
|