@xuda.io/ai_module 1.1.4073 → 1.1.4075

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 +15 -11
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -5609,9 +5609,10 @@ export const convert_profile_image_to_avatar = async function (req, job_id, head
5609
5609
  };
5610
5610
 
5611
5611
  // const drive_module = await import(`${module_path}/drive_module/index.mjs`);
5612
- const { url, uid, account_obj, prompt } = req;
5613
-
5614
- await update_profile_avatar_status(account_obj._id, 2);
5612
+ const { url, uid, account_obj, prompt, profile_id } = req;
5613
+ if (!profile_id) {
5614
+ await update_profile_avatar_status(account_obj._id, 2);
5615
+ }
5615
5616
  try {
5616
5617
  if (!url) {
5617
5618
  throw new Error('No URL provided in request');
@@ -5811,14 +5812,17 @@ export const convert_profile_image_to_avatar = async function (req, job_id, head
5811
5812
  const drive_ret = await drive_module.upload_drive_file_user({ uid, path: '/Profile Images' }, job_id, headers, file_obj);
5812
5813
 
5813
5814
  if (drive_ret.code > 0) {
5814
- let db_doc = await db_module.get_couch_doc_native('xuda_accounts', account_obj._id);
5815
- db_doc.account_info.profile_avatar = drive_ret.data.file_url;
5816
- db_doc.account_info.profile_avatar_obj == drive_ret.data;
5817
- db_doc.account_info.avatar_source = avatar_source;
5818
- db_doc.image_request_ts = Date.now();
5819
- const save_ret = await db_module.save_couch_doc_native('xuda_accounts', db_doc);
5820
- console.log(save_ret);
5821
- await update_profile_avatar_status(uid, 3);
5815
+ if (!profile_id) {
5816
+ let db_doc = await db_module.get_couch_doc_native('xuda_accounts', account_obj._id);
5817
+ db_doc.account_info.profile_avatar = drive_ret.data.file_url;
5818
+ db_doc.account_info.profile_avatar_obj == drive_ret.data;
5819
+ db_doc.account_info.avatar_source = avatar_source;
5820
+ db_doc.image_request_ts = Date.now();
5821
+ const save_ret = await db_module.save_couch_doc_native('xuda_accounts', db_doc);
5822
+ console.log(save_ret);
5823
+ await update_profile_avatar_status(uid, 3);
5824
+ } else {
5825
+ }
5822
5826
  return save_ret;
5823
5827
  // account_module.update_contacts_with_account_changes(db_doc._id, ['profile_avatar']);
5824
5828
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.4073",
3
+ "version": "1.1.4075",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",