diff --git a/api/app/clients/tools/structured/StableDiffusion.js b/api/app/clients/tools/structured/StableDiffusion.js index 6e15db72b8..e891cbb398 100644 --- a/api/app/clients/tools/structured/StableDiffusion.js +++ b/api/app/clients/tools/structured/StableDiffusion.js @@ -103,8 +103,8 @@ class StableDiffusionAPI extends StructuredTool { const filepath = path.join(imageOutputPath, this.userId, imageName); this.relativePath = path.relative(clientPath, imageOutputPath); - if (!fs.existsSync(imageOutputPath)) { - fs.mkdirSync(imageOutputPath, { recursive: true }); + if (!fs.existsSync(path.join(imageOutputPath, this.userId))) { + fs.mkdirSync(path.join(imageOutputPath, this.userId), { recursive: true }); } try {