@xuda.io/ai_module 1.1.4845 → 1.1.4847
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.
- package/index.mjs +15 -9
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -69,6 +69,7 @@ const jobs_module = await import(`${module_path}/jobs_module/index.mjs`);
|
|
|
69
69
|
var open_ai_status = {};
|
|
70
70
|
const report_ai_status = function (model, err) {
|
|
71
71
|
open_ai_status[model] = { stat: err ? 'error' : 'ok', date: new Date(), err };
|
|
72
|
+
console.error(err);
|
|
72
73
|
};
|
|
73
74
|
|
|
74
75
|
let client;
|
|
@@ -78,9 +79,7 @@ try {
|
|
|
78
79
|
});
|
|
79
80
|
|
|
80
81
|
console.log('chat-gpt client initiated..OK');
|
|
81
|
-
} catch (err) {
|
|
82
|
-
console.error(err);
|
|
83
|
-
}
|
|
82
|
+
} catch (err) {}
|
|
84
83
|
const model = 'gpt-5-nano';
|
|
85
84
|
|
|
86
85
|
// var studio_units = {};
|
|
@@ -6287,12 +6286,19 @@ export const get_profile_picture = async function (uid, account_type = 'business
|
|
|
6287
6286
|
const prompt = `
|
|
6288
6287
|
extract the logo from the image
|
|
6289
6288
|
`;
|
|
6290
|
-
|
|
6291
|
-
|
|
6292
|
-
|
|
6293
|
-
|
|
6294
|
-
|
|
6295
|
-
|
|
6289
|
+
let image_response;
|
|
6290
|
+
try {
|
|
6291
|
+
image_response = await client.images.edit({
|
|
6292
|
+
model,
|
|
6293
|
+
image: image_blob_ret.image_blob,
|
|
6294
|
+
prompt,
|
|
6295
|
+
background: 'transparent',
|
|
6296
|
+
});
|
|
6297
|
+
report_ai_status(model);
|
|
6298
|
+
} catch (err) {
|
|
6299
|
+
report_ai_status(model, err);
|
|
6300
|
+
throw err;
|
|
6301
|
+
}
|
|
6296
6302
|
|
|
6297
6303
|
imageBase64 = await normalizeBase64To1024(image_response.data[0].b64_json, resize);
|
|
6298
6304
|
account_module.record_ai_usage(uid, image_response.usage.input_tokens, image_response.usage.output_tokens, 'profile image', prompt, model, { url }, account_profile_info);
|