@xuda.io/ai_module 1.1.4665 → 1.1.4667

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 +20 -4
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -3455,6 +3455,22 @@ export const update_thumbnail = async function (type, doc, app_id, uid, job_id,
3455
3455
  break;
3456
3456
  }
3457
3457
 
3458
+ case 'conversation_category': {
3459
+ prompt = `create image: ${doc.category_info.category}`;
3460
+ let images_arr;
3461
+ const cache = await get_chat_picture_cache(uid, 'chat_thumbnail', doc.category_info.category);
3462
+ images_arr = [cache];
3463
+ if (!cache) {
3464
+ images_arr = await create_and_upload_image_to_drive('user', 'Chat Thumbnails', doc._id, prompt, 1, uid, app_id, job_id, headers, true, tags, account_profile_info);
3465
+ account_module.save_xuda_cache(uid, 'chat_thumbnail', doc.category_info.category, images_arr[0], { tags });
3466
+ }
3467
+ db_doc = await get_db_doc();
3468
+ db_doc.thumbnail_request_ts = Date.now();
3469
+ db_doc.chat_image = images_arr;
3470
+
3471
+ break;
3472
+ }
3473
+
3458
3474
  case 'mini_app': {
3459
3475
  if (doc.studio_meta.agent_image) return;
3460
3476
  prompt = `create image: ${doc.properties.menuName}`;
@@ -4345,12 +4361,12 @@ const process_conversation = async function (uid, conversation_id, account_profi
4345
4361
  }
4346
4362
  }
4347
4363
  conversation_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, conversation_doc._id);
4348
- contact_doc.category_info = category_info;
4364
+ conversation_doc.category_info = category_info;
4349
4365
  await db_module.save_app_couch_doc_native(account_profile_info.app_id, conversation_doc);
4350
4366
 
4351
- // if (perform_ai_execution) {
4352
- // await update_thumbnail('conversation', conversation_doc, account_profile_info.app_id, uid, job_id, headers, null, null, account_profile_info);
4353
- // }
4367
+ if (category_info.category) {
4368
+ await update_thumbnail('conversation_category', conversation_doc, account_profile_info.app_id, uid, job_id, headers, null, null, account_profile_info);
4369
+ }
4354
4370
  if (conversation_doc.reference_type === 'contacts') {
4355
4371
  if (recipient_uid) {
4356
4372
  // valid for chat conversation
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.4665",
3
+ "version": "1.1.4667",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",