How prompt suggestions work
The suggestion system uses ChatGPT to generate creative, detailed prompts specifically designed for image generation.Request a suggestion
When you first load VisionaryAI, a prompt suggestion automatically appears in the text area as placeholder text.
Review the suggestion
The suggestion includes details like artistic style, subject matter, and technical descriptors to help DALL-E 3 create high-quality images.
Suggestions are fetched on-demand using SWR (stale-while-revalidate), ensuring fresh ideas without unnecessary API calls.
User interface
The prompt input area includes three interactive buttons:Generate button
Use your own custom prompt to create an image:- Located on the right side of the text area
- Activates when you type any text
- Turns violet with white text when enabled
- Disabled (grayed out) when the input is empty
components/PromptInput.tsx
Use suggestion button
Generate an image using the current AI suggestion:- Always active (violet background)
- Sends the suggested prompt directly to DALL-E 3
- Saves you from manually copying the suggestion
components/PromptInput.tsx
New suggestion button
Fetch a fresh prompt idea from ChatGPT:- White background with violet text
- Triggers a new API request to the suggestion endpoint
- Shows loading state while fetching
Suggestion display
The interface provides multiple ways to see the current suggestion:Placeholder text
When the input is empty, the suggestion appears as placeholder text:components/PromptInput.tsx
Loading state
Loading state
While fetching a new suggestion, the placeholder shows:
Suggestion ready
Suggestion ready
Once loaded, the full suggestion text appears as placeholder text in the textarea.
Below-input display
When you start typing your own prompt, the suggestion moves below the input:components/PromptInput.tsx
What makes a good suggestion?
The suggestion system is optimized to generate prompts that work well with DALL-E 3:Style descriptors
Suggestions include specific artistic styles:- Oil painting
- Watercolor
- Photo-realistic
- Abstract
- Modern
- Black and white
Technical details
Suggestions often specify quality indicators:- 4K resolution
- Highly detailed
- Professional quality
- Studio lighting
Subject and composition
Each suggestion provides clear subject matter with compositional details to help DALL-E 3 create coherent images.Technical implementation
The suggestion feature uses several technologies working together:Frontend data fetching
VisionaryAI uses SWR for efficient data fetching:components/PromptInput.tsx
revalidateOnFocus: false prevents unnecessary API calls when you switch browser tabs, reducing costs and improving performance.API endpoint
The Next.js API route forwards requests to Azure:app/api/suggestion/route.ts
Azure Function with GPT-3.5
The Azure Function generates suggestions using OpenAI’s completion API:azure/src/functions/getChatGPTSuggestion.js
Why GPT-3.5 Turbo Instruct?
Why GPT-3.5 Turbo Instruct?
The
gpt-3.5-turbo-instruct model is optimized for completion tasks and provides creative, varied responses. The high temperature (0.9) ensures diverse suggestions.Token limit
Token limit
Suggestions are capped at 100 tokens, providing enough detail without overwhelming users or wasting API quota.
Best practices
- For exploration
- For precision
- For learning
Use the suggestion feature when:
- You’re new to AI image generation
- You want to discover new artistic styles
- You’re experiencing creative block
- You want to test DALL-E 3’s capabilities
Performance optimization
The suggestion system is designed for efficiency:Caching strategy
SWR caches suggestions in memory, so:- Returning to the page shows the previous suggestion instantly
- Network requests only occur when explicitly requested
- The UI remains responsive during fetching
Automatic revalidation disabled
By settingrevalidateOnFocus: false, suggestions don’t refresh when:
- You switch browser tabs
- You click back into the window
- The page regains focus
Next steps
Image generation
Learn how to generate images from your prompts
Image gallery
Discover how to browse your generated artwork