97 lines
2.0 KiB
Markdown
97 lines
2.0 KiB
Markdown
### Prompt Bench
|
|
|
|
A small ComfyUI helper for iterative prompt improvement with Ollama.
|
|
|
|
It lets you simply:
|
|
|
|
- score an image, make notes and shape the result with structured ratings.
|
|
- turn feedback into a revised prompt.
|
|
- keep a chat-style history per session that is selectable using a seed.
|
|
- save prompt/rating snapshots to disk under comfyui/users/prompt_bench folder.
|
|
|
|
## Nodes
|
|
|
|
### PBTextModelChat
|
|
|
|
Generates the next prompt revision through Ollama chat.
|
|
|
|
Inputs:
|
|
|
|
- session_seed: session key; reuse it to continue the same conversation, change it to start a new one
|
|
- system_prompt: initial instruction for the model
|
|
- rating: structured feedback from PBRating
|
|
- model: Ollama model name
|
|
- text (optional): extra user input
|
|
|
|
Outputs:
|
|
|
|
- enhanced_prompt
|
|
- model
|
|
- text
|
|
- chat
|
|
|
|
### PBRating
|
|
|
|
Creates a structured rating payload.
|
|
|
|
Inputs:
|
|
|
|
- notes
|
|
- prompt_adherence
|
|
- aesthetics
|
|
- technical_quality
|
|
- lighting
|
|
- detail_richness
|
|
- coherence
|
|
|
|
Output:
|
|
|
|
- rating
|
|
|
|
### PBStore
|
|
|
|
Saves prompt runs as JSON files.
|
|
|
|
Inputs:
|
|
|
|
- prompt
|
|
- rating
|
|
- model
|
|
- text
|
|
- images (optional, currently unused)
|
|
|
|
Behavior:
|
|
|
|
- saves data under the ComfyUI user folder in prompt_bench/store/<text-based-id>/
|
|
|
|
### PBListChatView
|
|
|
|
Formats chat history into readable text in the UI.
|
|
|
|
Inputs:
|
|
|
|
- chat
|
|
- text
|
|
|
|
Output:
|
|
|
|
- formatted chat transcript
|
|
|
|
## Basic Workflow
|
|
|
|
1. Rate the current result with PBRating.
|
|
2. Send that rating into PBTextModelChat.
|
|
3. PBTextModelChat uses the current session history plus the new rating feedback to ask Ollama for a better prompt.
|
|
4. Send the generated prompt, rating, model, and text into PBStore to save the run.
|
|
5. Send the chat output into PBListChatView to inspect the session history.
|
|
|
|
## Session Behavior
|
|
|
|
- Same session_seed = continue the same chat session
|
|
- Different session_seed = start a fresh session
|
|
|
|
## Notes
|
|
|
|
- Chat memory is stored in memory while ComfyUI is running.
|
|
- Model lists are fetched from the local Ollama server.
|
|
- Stored runs are saved as numbered JSON files. |