From ad1316d27b7fe910a43768f7c2a7daf36f4abd43 Mon Sep 17 00:00:00 2001 From: jonmatthis Date: Wed, 27 Nov 2024 13:16:59 -0500 Subject: [PATCH] incorporate user prompt in image gen --- src/interfaces/discord/commands/discord-image.command.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/interfaces/discord/commands/discord-image.command.ts b/src/interfaces/discord/commands/discord-image.command.ts index 26d40c7..1f1b08c 100644 --- a/src/interfaces/discord/commands/discord-image.command.ts +++ b/src/interfaces/discord/commands/discord-image.command.ts @@ -60,15 +60,20 @@ export class DiscordImageCommand { .map((message) => message.content) .join(' \n '); + let promptInstructions = + 'Condense the provided INPUT TEXT into a 200 word (or less) prompt that will be used to generate an image. Do not generate any text other than the image generation prompt'; + if (imagePromptDto && imagePromptDto.prompt) { + promptInstructions = imagePromptDto.prompt; + } promptText = await this._openaiTextService.generateText({ - prompt: `Condense the provided INPUT TEXT into a 200 word (or less) prompt that will be used to generate an image. Do not generate any text other than the image generation prompt.\n\n--------BEGIN INPUT TEXT\n\n ${contextText} \n\n ---------------END OF INPUT TEXT\n\nREMEMBER! Condense the provided INPUT TEXT into a 200 word (or less) prompt that will be used to generate an image. Do not generate any text other than the image generation prompt.`, + prompt: `${promptInstructions}.\n\n--------BEGIN INPUT TEXT\n\n ${contextText} \n\n ---------------END OF INPUT TEXT\n\nREMEMBER! Your task is toyeah, ${promptInstructions}.`, model: 'gpt-4o', temperature: 0.5, max_tokens: 300, }); } await interaction.editReply({ - content: `Generating image from prompt:\n > ${promptText} \n Please wait...`, + content: `Generating image from prompt:\n > ${promptText} \n\n Please wait...`, }); // generate image const response: ImagesResponse =