Don't completely remove the tmpDir; ensure it exists before saving a generated image to it

This commit is contained in:
Alex Gleason committed 2025-12-07 20:02:01 -06:00
1 parent 38450a4793
commit fefd589187
3 files changed
+41 -12

No files matched your search

+7
View File
@@ -142,6 +142,13 @@ export class GenerateImageTool implements Tool<GenerateImageParams> {
const filename = `generated-${timestamp}.${extension}`;
const filepath = `${this.tmpPath}/${filename}`;
// Ensure tmp directory exists
try {
await this.fs.stat(this.tmpPath);
} catch {
await this.fs.mkdir(this.tmpPath, { recursive: true });
}
// Write image to VFS
await this.fs.writeFile(filepath, imageData);