@xuda.io/ai_module 1.1.4837 → 1.1.4839

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 +29 -15
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -3887,15 +3887,22 @@ const chat_email = async function (req, job_id, headers) {
3887
3887
  if (perform_ai_execution) {
3888
3888
  await attachment_handler(uid, sender_app_id, conversation_id, attachments, account_profile_info);
3889
3889
  }
3890
- const item = await client.conversations.items.create(conversation_doc.reference_conversation_id, {
3891
- items: [
3892
- {
3893
- type: 'message',
3894
- role: 'user',
3895
- content: [{ type: 'input_text', text: body || '' }],
3896
- },
3897
- ],
3898
- });
3890
+ let item;
3891
+ try {
3892
+ item = await client.conversations.items.create(conversation_doc.reference_conversation_id, {
3893
+ items: [
3894
+ {
3895
+ type: 'message',
3896
+ role: 'user',
3897
+ content: [{ type: 'input_text', text: body || '' }],
3898
+ },
3899
+ ],
3900
+ });
3901
+ report_ai_status('conversations');
3902
+ } catch (err) {
3903
+ report_ai_status('conversations', err);
3904
+ throw err;
3905
+ }
3899
3906
 
3900
3907
  // let obj = { id: item.data[0].id, ts: Date.now(), uid, read: true, conversation_type: 'email' };
3901
3908
 
@@ -5712,13 +5719,20 @@ const create_ai_agent_image = async function (req, job_id, headers) {
5712
5719
  - Light interaction Use advanced or reflective materials to convey intelligence and sophistication.
5713
5720
  The overall composition should symbolize the fusion of human creativity and machine intelligence.
5714
5721
  `;
5715
- const ai_avatar_response = await client.images.edit({
5716
- model,
5717
- image: image_blob_ret.image_blob,
5718
5722
 
5719
- prompt,
5720
- background: 'transparent',
5721
- });
5723
+ let ai_avatar_response;
5724
+ try {
5725
+ ai_avatar_response = await client.images.edit({
5726
+ model,
5727
+ image: image_blob_ret.image_blob,
5728
+
5729
+ prompt,
5730
+ background: 'transparent',
5731
+ });
5732
+ } catch (err) {
5733
+ report_ai_status(model, err);
5734
+ throw err;
5735
+ }
5722
5736
  imageBase64 = ai_avatar_response.data[0].b64_json;
5723
5737
  account_module.record_ai_usage(uid, ai_avatar_response.usage.input_tokens, ai_avatar_response.usage.output_tokens, 'agent avatar', prompt, model, { ai_agent_id }, account_profile_info);
5724
5738
  console.log('Normalizing final avatar to 1024 with transparent padding...');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.4837",
3
+ "version": "1.1.4839",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",