@xuda.io/ai_module 1.1.4839 → 1.1.4841

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 +14 -6
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -5377,13 +5377,20 @@ export const get_profile_avatar = async function (profile_picture, uid, prompt,
5377
5377
  // const { first_name, last_name, bio, country, mainCategory, subCategory } = account_obj.account_info;
5378
5378
  // const model = 'gpt-image-1-mini';
5379
5379
  const model = 'chatgpt-image-latest';
5380
- const ai_avatar_response = await client.images.edit({
5381
- model,
5382
- image: image_blob_ret.image_blob,
5380
+ let ai_avatar_response;
5381
+ try {
5382
+ ai_avatar_response = await client.images.edit({
5383
+ model,
5384
+ image: image_blob_ret.image_blob,
5383
5385
 
5384
- prompt,
5385
- background: 'transparent',
5386
- });
5386
+ prompt,
5387
+ background: 'transparent',
5388
+ });
5389
+ report_ai_status(model);
5390
+ } catch (err) {
5391
+ report_ai_status(model, err);
5392
+ throw err;
5393
+ }
5387
5394
  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);
5388
5395
  imageBase64 = ai_avatar_response.data[0].b64_json;
5389
5396
  avatar_source = 'ai profile';
@@ -5729,6 +5736,7 @@ const create_ai_agent_image = async function (req, job_id, headers) {
5729
5736
  prompt,
5730
5737
  background: 'transparent',
5731
5738
  });
5739
+ report_ai_status(model);
5732
5740
  } catch (err) {
5733
5741
  report_ai_status(model, err);
5734
5742
  throw err;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.4839",
3
+ "version": "1.1.4841",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",