@xuda.io/ai_module 1.1.4552 → 1.1.4553
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 +0 -41
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -6114,47 +6114,6 @@ const create_ai_agent_image = async function (req, job_id, headers) {
|
|
|
6114
6114
|
let url = account_doc.account_info.profile_avatar;
|
|
6115
6115
|
|
|
6116
6116
|
try {
|
|
6117
|
-
// if (!url) {
|
|
6118
|
-
// throw new Error('No URL provided in request');
|
|
6119
|
-
// }
|
|
6120
|
-
|
|
6121
|
-
// // 3. Download the image to a Buffer
|
|
6122
|
-
// const res = await fetch(url);
|
|
6123
|
-
// if (!res.ok) {
|
|
6124
|
-
// throw new Error(`Failed to fetch image URL: ${res.status} ${res.statusText}`);
|
|
6125
|
-
// }
|
|
6126
|
-
|
|
6127
|
-
// const arrayBuffer = await res.arrayBuffer();
|
|
6128
|
-
// const imageBuffer = Buffer.from(arrayBuffer);
|
|
6129
|
-
|
|
6130
|
-
// const tempDir = os.tmpdir();
|
|
6131
|
-
// const uniqueId = Date.now() + '_' + Math.random().toString(36).substring(7);
|
|
6132
|
-
|
|
6133
|
-
// const inputExt = path.extname(url) || '.jpg';
|
|
6134
|
-
// const tempInputPath = path.join(tempDir, `input_${uniqueId}${inputExt}`);
|
|
6135
|
-
// const tempOutputPath = path.join(tempDir, `output_${uniqueId}.png`); // Output is always PNG (transparent)
|
|
6136
|
-
|
|
6137
|
-
// 5. Write the downloaded image to disk
|
|
6138
|
-
// fs.writeFileSync(tempInputPath, imageBuffer);
|
|
6139
|
-
/////////////////////////////////
|
|
6140
|
-
|
|
6141
|
-
// const imageFiles = [tempInputPath];
|
|
6142
|
-
|
|
6143
|
-
// const images = await Promise.all(
|
|
6144
|
-
// imageFiles.map(async (filePath) => {
|
|
6145
|
-
// const img_ret = await imageToPngBlob(filePath);
|
|
6146
|
-
// const blob = img_ret.image_blob;
|
|
6147
|
-
|
|
6148
|
-
// // OpenAI expects a filename for logging/debugging
|
|
6149
|
-
// const filename = path.basename(filePath, path.extname(filePath)) + '.png';
|
|
6150
|
-
// blob.name = filename; // Optional but helpful
|
|
6151
|
-
// // @ts-ignore – name is allowed in Node 20+
|
|
6152
|
-
// blob.lastModified = Date.now();
|
|
6153
|
-
|
|
6154
|
-
// return { is_transparent: img_ret.is_transparent, image_blob: blob };
|
|
6155
|
-
// }),
|
|
6156
|
-
// );
|
|
6157
|
-
|
|
6158
6117
|
let imageBase64;
|
|
6159
6118
|
const image_blob_ret = await get_image_blob_from_downloaded_image(url);
|
|
6160
6119
|
//////////////////
|