@xuda.io/ai_module 1.1.4076 → 1.1.4078

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 +5 -5
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -5511,7 +5511,7 @@ const create_and_upload_image_to_drive = async function (drive_type, file_path,
5511
5511
  }
5512
5512
  };
5513
5513
 
5514
- export const convert_profile_image_to_avatar = async function (req, job_id, headers) {
5514
+ export const create_profile_avatar = async function (req, job_id, headers) {
5515
5515
  async function normalizeBase64To1024(base64Image) {
5516
5516
  const inputBuffer = Buffer.from(base64Image, 'base64');
5517
5517
 
@@ -5609,8 +5609,8 @@ 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, profile_id } = req;
5613
- if (!profile_id) {
5612
+ const { url, uid, account_obj, prompt, is_profile_avatar } = req;
5613
+ if (!is_profile_avatar) {
5614
5614
  await update_profile_avatar_status(account_obj._id, 2);
5615
5615
  }
5616
5616
  try {
@@ -5812,7 +5812,7 @@ export const convert_profile_image_to_avatar = async function (req, job_id, head
5812
5812
  const drive_ret = await drive_module.upload_drive_file_user({ uid, path: '/Profile Images' }, job_id, headers, file_obj);
5813
5813
 
5814
5814
  if (drive_ret.code > 0) {
5815
- if (!profile_id) {
5815
+ if (!is_profile_avatar) {
5816
5816
  let db_doc = await db_module.get_couch_doc_native('xuda_accounts', account_obj._id);
5817
5817
  db_doc.account_info.profile_avatar = drive_ret.data.file_url;
5818
5818
  db_doc.account_info.profile_avatar_obj == drive_ret.data;
@@ -5958,7 +5958,7 @@ export const modify_profile_avatar = async function (req, job_id, headers) {
5958
5958
  }
5959
5959
 
5960
5960
  let account_obj = await db_module.get_couch_doc_native('xuda_accounts', uid);
5961
- const ret = await convert_profile_image_to_avatar({ prompt, url: account_obj.account_info?.profile_avatar, uid, account_obj }, job_id, headers);
5961
+ const ret = await create_profile_avatar({ prompt, url: account_obj.account_info?.profile_avatar, uid, account_obj }, job_id, headers);
5962
5962
  return ret;
5963
5963
  } catch (err) {
5964
5964
  return { code: -111, data: err.message };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.4076",
3
+ "version": "1.1.4078",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",