@xuda.io/ai_module 1.1.4843 → 1.1.4844

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 +13 -6
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -5200,12 +5200,19 @@ export const get_profile_avatar = async function (profile_picture, uid, prompt,
5200
5200
  let avatar_source = '';
5201
5201
  if (prompt) {
5202
5202
  const model = 'chatgpt-image-latest';
5203
- const ai_avatar_response = await client.images.edit({
5204
- model,
5205
- image: image_blob_ret.image_blob, //base photo
5206
- prompt,
5207
- background: 'transparent',
5208
- });
5203
+ let ai_avatar_response;
5204
+ try {
5205
+ ai_avatar_response = await client.images.edit({
5206
+ model,
5207
+ image: image_blob_ret.image_blob, //base photo
5208
+ prompt,
5209
+ background: 'transparent',
5210
+ });
5211
+ report_ai_status(model);
5212
+ } catch (err) {
5213
+ report_ai_status(model, err);
5214
+ throw err;
5215
+ }
5209
5216
  imageBase64 = ai_avatar_response.data[0].b64_json;
5210
5217
  account_module.record_ai_usage(uid, ai_avatar_response.usage.input_tokens, ai_avatar_response.usage.output_tokens, 'profile avatar', prompt, model, { profile_picture }, account_profile_info);
5211
5218
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.4843",
3
+ "version": "1.1.4844",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",