ShowLastMessage
ShowLastMessage shows the tail of your chat
- messages
- messages
Debugging an LLM workflow is mostly "what did the model actually see last?" ShowLastMessage is the answer to that: it's a display node that renders the last message in your LLLM_MESSAGES chain right on the node - role and content - and passes the whole chain through untouched so it doesn't disturb your graph.
It's the LLM-workflow equivalent of dropping a Preview node on an image. If you're building multi-turn conversations, you want to check what the final state of the chat is before it hits the completion node - especially when you've chained four LiteLLMMessage nodes and can't remember what the last one said.
How it works
Required input: messages (LLLM_MESSAGES). Optional: list_display (STRING, multiline) - a read-only display widget the node's JavaScript writes into after execution. The handler takes the last message, formats it as ROLE: on one line and the content on the next, and returns it as UI text; the whole message list comes back unchanged as the output (also named messages, type LLLM_MESSAGES).
That passthrough is the part people miss: this is an inspection node, not a terminal one. The output is the identical list you fed in, so you can drop it anywhere in the middle of a chain to peek and keep going - nothing upstream or downstream changes.
Using it
The natural spot is right before the completion call:
LiteLLMMessage (system) → LiteLLMMessage (user) → ShowLastMessage → LiteLLMCompletion
Run the graph, read what the model is about to receive, and catch mistakes (wrong role, truncated content, a stray default "Hello World!") before you spend tokens on an API call. Since it's marked an output node (OUTPUT_NODE = True), the workflow considers the chain "done" here - you can run just the message-building part to inspect without ever calling the model.
Installing
Pack-level: ComfyUI Manager → search "LiteLLM" (repo Hopping-Mad-Games/ComfyUI_LiteLLM) → Install → Restart, or clone into ComfyUI/custom_nodes and pip install -r requirements.txt. Heavy requirements (litellm, boto3, sentence-transformers, a LightRAG fork), but this node itself is pure local formatting - no keys, no API calls. The UI behavior comes from the pack's bundled js/ extension, which is why it needs a ComfyUI restart to take effect.
Gotchas
- Empty chain, empty show. If
messagesis empty,lst[-1]blows up with an index error - the node assumes at least one message. Wire in a default if your chain can legitimately be empty. - Last ≠ all. It shows one message. If you want the full transcript on screen, use
ShowMessagesinstead - same node, but it renders every message. For a plain string version you can save or wire into text nodes,MessagesToTextis the one.
Bottom line
A tiny, genuinely useful debugging node that belongs in almost every chat workflow you build. Two lines of prose per run, catches half the "why did it say that?" problems before they cost you anything. You'll use it more than you expect.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| messages | LLLM_MESSAGES | Something to show... | — |
| list_displayopt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| messages | LLLM_MESSAGES | — |