I'm Gopi Gugan, a software engineer building AI features with FastAPI, Postgres/pgvector, and React/TypeScript. I recently shipped an LLM feature where the model was fine — but the UI made it feel slow, unreliable, and hard to trust. The fix wasn't a better prompt. It was better UX. You can find more of my writing at gopigugan.ca.
Here's how I design React interfaces for LLM features so they feel fast and honest, even when the model is slow or uncertain.
Stream, don't wait
The single biggest UX win is streaming. Nobody wants to stare at a spinner for 20 seconds while a model thinks.
- Use server-sent events or a streaming fetch from your FastAPI backend and render tokens as they arrive.
- Show the first token fast, even if the full answer takes a while — perceived speed matters more than total time.
- Keep a visible "generating" state with a stop button. Users should always be able to interrupt.
const res = await fetch("/api/chat", { method: "POST", body: JSON.stringify({ prompt }) }); const reader = res.body!.getReader(); const decoder = new TextDecoder(); while (true) { const { done, value } = await reader.read(); if (done) break; setText((prev) => prev + decoder.decode(value)); } Show uncertainty, don't hide it
LLMs are wrong sometimes. A UI that presents every answer with total confidence trains users to trust it blindly — and then blame you when it fails.
- Label AI-generated content clearly. A small "AI-generated" badge costs nothing and buys a lot of trust.
- Show sources or citations when your RAG pipeline has them, so users can check the answer.
- For low-confidence answers, say so: "I'm not sure about this one — here's what I found."
- Never let the UI silently retry and present a different answer as if nothing happened.
Design for the slow path, not just the happy path
Most LLM demos show the perfect answer. Real users hit timeouts, rate limits, and empty responses.
- Set honest timeouts and show a useful fallback: "This is taking longer than usual. You can wait or try a shorter prompt."
- Keep the user's input safe. Never clear the prompt box on an error — losing a carefully written prompt is infuriating.
- Cache recent answers locally so a refresh doesn't force a full regeneration.
- Handle partial responses gracefully: render what arrived, and mark it as incomplete.
Give users control, not just a chat box
A bare chat input puts all the work on the user. A good LLM UI gives them levers.
- Offer suggested follow-ups and one-click actions like "Summarize", "Make it shorter", or "Show sources".
- Let users edit the AI's output inline instead of re-prompting from scratch.
- Keep a visible history they can revisit, rename, and delete.
- For long outputs, add structure: headings, collapsible sections, and copy buttons per section.
Measure what users feel, not just what the model does
Model benchmarks don't tell you whether the feature is usable. I track a few simple things:
- Time to first token, and time to complete answer.
- How often users stop generation, retry, or edit the output.
- How often users copy an answer — usually a sign it was actually useful.
- Error rate by type: timeouts, empty responses, and user-reported bad answers.
If users keep hitting stop, the model isn't too slow — the UI is showing them the wrong thing at the wrong time.
The takeaway
A good LLM feature is mostly good UI. Stream early, be honest about uncertainty, design for failures, and give users real control. The model does the thinking, but the interface decides whether anyone trusts it. That's the part I'm still learning to get right — one feature at a time.
