mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-06 08:37:22 +00:00
Don't completely remove the tmpDir; ensure it exists before saving a generated image to it
This commit is contained in:
3 files changed
+41
-12
No files matched your search
@@ -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);
|
||||
|
||||
|
||||
Reference in new issue
Block a user