diff --git a/api/app/langchain/tools/structured/StableDiffusion.js b/api/app/langchain/tools/structured/StableDiffusion.js index f2afbe0dc3..1fc7eeff53 100644 --- a/api/app/langchain/tools/structured/StableDiffusion.js +++ b/api/app/langchain/tools/structured/StableDiffusion.js @@ -20,8 +20,8 @@ Guidelines: "negative_prompt":"semi-realistic, cgi, 3d, render, sketch, cartoon, drawing, anime, out of frame, low quality, ugly, mutation, deformed" - Generate images only once per human query unless explicitly requested by the user`; this.schema = z.object({ - prompt: z.string().describe("Detailed keywords to describe the subject, separated by comma"), - negative_prompt: z.string().describe("Keywords we want to exclude from the final image") + prompt: z.string().describe("Detailed keywords to describe the subject, use at minimum but not limited to 5, separated by comma"), + negative_prompt: z.string().describe("Keywords we want to exclude from the final image, use at minimum but not limited to 5, separated by comma") }); } @@ -42,8 +42,9 @@ Guidelines: return url; } - async _call(prompt, negative_prompt) { + async _call(data) { const url = this.url; + const { prompt, negative_prompt } = data; const payload = { prompt, negative_prompt, @@ -57,8 +58,8 @@ Guidelines: // Generate unique name const imageName = `${Date.now()}.png`; - this.outputPath = path.resolve(__dirname, '..', '..', '..', '..', 'client', 'public', 'images'); - const appRoot = path.resolve(__dirname, '..', '..', '..', '..', 'client'); + this.outputPath = path.resolve(__dirname, '..', '..', '..', '..', '..', 'client', 'public', 'images'); + const appRoot = path.resolve(__dirname, '..', '..', '..', '..', '..', 'client'); this.relativeImageUrl = path.relative(appRoot, this.outputPath); // Check if directory exists, if not create it diff --git a/api/client/public/images/1686764042034.png b/api/client/public/images/1686764042034.png new file mode 100644 index 0000000000..c6925d366a Binary files /dev/null and b/api/client/public/images/1686764042034.png differ diff --git a/api/server/routes/ask/askGPTPlugins.js b/api/server/routes/ask/askGPTPlugins.js index 56b18364c8..f15d585656 100644 --- a/api/server/routes/ask/askGPTPlugins.js +++ b/api/server/routes/ask/askGPTPlugins.js @@ -3,7 +3,7 @@ const router = express.Router(); const { titleConvo } = require('../../../app/'); // const { getOpenAIModels } = require('../endpoints'); const ChatAgent = require('../../../app/langchain/ChatAgent'); -const { validateTools } = require('../../../app/langchain/tools'); +const { validateTools } = require('../../../app/langchain/tools/util'); const { saveMessage, getConvoTitle, saveConvo, getConvo } = require('../../../models'); const { handleError,