@xuda.io/ai_module 1.1.3850 → 1.1.3851
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 +3 -3
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -2018,7 +2018,7 @@ export const unarchive_ai_chat = async function (req) {
|
|
|
2018
2018
|
// }
|
|
2019
2019
|
// };
|
|
2020
2020
|
|
|
2021
|
-
const create_image = async function (uid, prompt, model = 'gpt-image-1-mini', size = '1024x1024', n = 1, width = 256, height = 256) {
|
|
2021
|
+
const create_image = async function (uid, prompt, model = 'gpt-image-1-mini', size = '1024x1024', n = 1, width = 256, height = 256, metadata = {}) {
|
|
2022
2022
|
try {
|
|
2023
2023
|
const response = await client.images.generate({
|
|
2024
2024
|
model,
|
|
@@ -2062,7 +2062,7 @@ const create_image = async function (uid, prompt, model = 'gpt-image-1-mini', si
|
|
|
2062
2062
|
|
|
2063
2063
|
const thumbnailBase64 = resized.toString('base64');
|
|
2064
2064
|
|
|
2065
|
-
record_chat_usage(uid, response.usage.input_tokens, response.usage.output_tokens, 'create image', prompt, model);
|
|
2065
|
+
record_chat_usage(uid, response.usage.input_tokens, response.usage.output_tokens, 'create image', prompt, model, metadata);
|
|
2066
2066
|
|
|
2067
2067
|
return thumbnailBase64;
|
|
2068
2068
|
} catch (err) {
|
|
@@ -5462,7 +5462,7 @@ const get_plugin_tool = async function (app_id, uid, plugin_name, method, prop_d
|
|
|
5462
5462
|
const create_and_upload_image_to_drive = async function (drive_type, file_path, file_name, prompt, numGenerations, uid, app_id, job_id, headers, is_system, tags = [], width, height) {
|
|
5463
5463
|
try {
|
|
5464
5464
|
// 1. Generate the images
|
|
5465
|
-
let result = await create_image(uid, prompt, undefined, undefined, numGenerations);
|
|
5465
|
+
let result = await create_image(uid, prompt, undefined, undefined, numGenerations, undefined, undefined, { drive_type, file_path, file_name });
|
|
5466
5466
|
|
|
5467
5467
|
// Normalize to array
|
|
5468
5468
|
const images = Array.isArray(result) ? result : [result];
|