Skip to content

Commit

Permalink
incorporate user prompt in image gen
Browse files Browse the repository at this point in the history
  • Loading branch information
jonmatthis committed Nov 27, 2024
1 parent fe6fb16 commit ad1316d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/interfaces/discord/commands/discord-image.command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down

0 comments on commit ad1316d

Please sign in to comment.