@xuda.io/ai_module 1.1.4662 → 1.1.4663

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 +81 -80
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -4205,89 +4205,90 @@ export const create_conversation = async function (req, job_id, headers) {
4205
4205
  const save_ret = await db_module.save_app_couch_doc(app_id, { ...conversation_doc, ...{ uid: recipient_uid, reference_id: recipient_contact_id } });
4206
4206
  }
4207
4207
 
4208
- // setTimeout(async () => {
4209
- // // Ask GPT for title
4210
- // if (conversation_type !== 'email') {
4211
- // if (prompt.split(' ').length > 10) {
4212
- // 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 });
4213
-
4214
- // conversation_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, conversation_doc._id);
4215
- // conversation_doc.title = title.data;
4216
-
4217
- // await db_module.save_app_couch_doc_native(account_profile_info.app_id, conversation_doc);
4218
- // }
4219
- // }
4220
- // /// categorize prompt
4221
- // let category_info = {};
4222
- // switch (conversation_type) {
4223
- // case 'ai': {
4224
- // category_info = await categorize_ai_prompt(uid, prompt, account_profile_info);
4225
- // break;
4226
- // }
4208
+ setTimeout(async () => {
4209
+ process_conversation(uid, conversation_doc._id, account_profile_info, job_id, headers);
4210
+ // // Ask GPT for title
4211
+ // if (conversation_type !== 'email') {
4212
+ // if (prompt.split(' ').length > 10) {
4213
+ // 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 });
4227
4214
 
4228
- // case 'email': {
4229
- // category_info = await categorize_email_subject(uid, prompt, account_profile_info);
4230
- // break;
4231
- // }
4215
+ // conversation_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, conversation_doc._id);
4216
+ // conversation_doc.title = title.data;
4232
4217
 
4233
- // case 'chat': {
4234
- // category_info = await categorize_text_message(uid, prompt, account_profile_info);
4235
- // break;
4236
- // }
4237
-
4238
- // case 'note': {
4239
- // category_info = await categorize_contact_note(uid, prompt, account_profile_info);
4240
- // break;
4241
- // }
4242
-
4243
- // default:
4244
- // break;
4245
- // }
4218
+ // await db_module.save_app_couch_doc_native(account_profile_info.app_id, conversation_doc);
4219
+ // }
4220
+ // }
4221
+ // /// categorize prompt
4222
+ // let category_info = {};
4223
+ // switch (conversation_type) {
4224
+ // case 'ai': {
4225
+ // category_info = await categorize_ai_prompt(uid, prompt, account_profile_info);
4226
+ // break;
4227
+ // }
4228
+
4229
+ // case 'email': {
4230
+ // category_info = await categorize_email_subject(uid, prompt, account_profile_info);
4231
+ // break;
4232
+ // }
4233
+
4234
+ // case 'chat': {
4235
+ // category_info = await categorize_text_message(uid, prompt, account_profile_info);
4236
+ // break;
4237
+ // }
4238
+
4239
+ // case 'note': {
4240
+ // category_info = await categorize_contact_note(uid, prompt, account_profile_info);
4241
+ // break;
4242
+ // }
4243
+
4244
+ // default:
4245
+ // break;
4246
+ // }
4246
4247
 
4247
- // conversation_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, conversation_doc._id);
4248
- // contact_doc.category_info = category_info;
4249
- // await db_module.save_app_couch_doc_native(account_profile_info.app_id, conversation_doc);
4248
+ // conversation_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, conversation_doc._id);
4249
+ // contact_doc.category_info = category_info;
4250
+ // await db_module.save_app_couch_doc_native(account_profile_info.app_id, conversation_doc);
4250
4251
 
4251
- // if (perform_ai_execution) {
4252
- // // await update_thumbnail('conversation', conversation_doc, account_profile_info.app_id, uid, job_id, headers, null, null, account_profile_info);
4253
- // }
4254
- // if (conversation_doc.reference_type === 'contacts') {
4255
- // if (recipient_uid) {
4256
- // // valid for chat conversation
4257
- // // write conversation to host after thumbnail update
4258
- // // get sender conversation
4259
-
4260
- // const conversation_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, conversation_doc._id);
4261
-
4262
- // const recipient_account_profile_info = await ac3180count_module.get_active_account_profile_info(recipient_uid);
4263
- // let recipient_conversation_doc = await db_module.get_app_couch_doc_native(recipient_account_profile_info.app_id, conversation_doc._id);
4264
- // recipient_conversation_doc.title = conversation_doc.title;
4265
-
4266
- // recipient_conversation_doc.thumbnail_request_ts = conversation_doc.thumbnail_request_ts;
4267
- // recipient_conversation_doc.chat_image = conversation_doc.chat_image;
4268
- // await db_module.save_app_couch_doc_native(recipient_account_profile_info.app_id, recipient_conversation_doc);
4269
-
4270
- // await update_conversation_mood_level(
4271
- // uid,
4272
- // [
4273
- // { uid: account_profile_info.uid, contact_id: reference_id },
4274
- // { uid: recipient_uid, contact_id: recipient_contact_id },
4275
- // ],
4276
- // conversation_doc._id,
4277
- // prompt,
4278
- // uid,
4279
- // recipient_uid,
4280
- // true,
4281
- // account_profile_info,
4282
- // );
4283
- // } else {
4284
- // // other cases rather then chat
4285
- // if (perform_ai_execution) {
4286
- // 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);
4287
- // }
4288
- // }
4289
- // }
4290
- // }, 1000);
4252
+ // if (perform_ai_execution) {
4253
+ // // await update_thumbnail('conversation', conversation_doc, account_profile_info.app_id, uid, job_id, headers, null, null, account_profile_info);
4254
+ // }
4255
+ // if (conversation_doc.reference_type === 'contacts') {
4256
+ // if (recipient_uid) {
4257
+ // // valid for chat conversation
4258
+ // // write conversation to host after thumbnail update
4259
+ // // get sender conversation
4260
+
4261
+ // const conversation_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, conversation_doc._id);
4262
+
4263
+ // const recipient_account_profile_info = await ac3180count_module.get_active_account_profile_info(recipient_uid);
4264
+ // let recipient_conversation_doc = await db_module.get_app_couch_doc_native(recipient_account_profile_info.app_id, conversation_doc._id);
4265
+ // recipient_conversation_doc.title = conversation_doc.title;
4266
+
4267
+ // recipient_conversation_doc.thumbnail_request_ts = conversation_doc.thumbnail_request_ts;
4268
+ // recipient_conversation_doc.chat_image = conversation_doc.chat_image;
4269
+ // await db_module.save_app_couch_doc_native(recipient_account_profile_info.app_id, recipient_conversation_doc);
4270
+
4271
+ // await update_conversation_mood_level(
4272
+ // uid,
4273
+ // [
4274
+ // { uid: account_profile_info.uid, contact_id: reference_id },
4275
+ // { uid: recipient_uid, contact_id: recipient_contact_id },
4276
+ // ],
4277
+ // conversation_doc._id,
4278
+ // prompt,
4279
+ // uid,
4280
+ // recipient_uid,
4281
+ // true,
4282
+ // account_profile_info,
4283
+ // );
4284
+ // } else {
4285
+ // // other cases rather then chat
4286
+ // if (perform_ai_execution) {
4287
+ // 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);
4288
+ // }
4289
+ // }
4290
+ // }
4291
+ }, 1000);
4291
4292
 
4292
4293
  return save_ret;
4293
4294
  } catch (err) {
@@ -4346,7 +4347,7 @@ const process_conversation = async function (uid, conversation_id, account_profi
4346
4347
  await db_module.save_app_couch_doc_native(account_profile_info.app_id, conversation_doc);
4347
4348
 
4348
4349
  // if (perform_ai_execution) {
4349
- await update_thumbnail('conversation', conversation_doc, account_profile_info.app_id, uid, job_id, headers, null, null, account_profile_info);
4350
+ // await update_thumbnail('conversation', conversation_doc, account_profile_info.app_id, uid, job_id, headers, null, null, account_profile_info);
4350
4351
  // }
4351
4352
  if (conversation_doc.reference_type === 'contacts') {
4352
4353
  if (recipient_uid) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.4662",
3
+ "version": "1.1.4663",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",