streaming
Technical notes on web development, DevOps, and AI integration.
5 articles
- 16:51backend
The Marker That Hid Between Two Chunks
A correct regex run against stream fragments matches nothing when the marker spans two deltas. Strip the joined answer instead.
TL;DR: A CTA_FLAG marker leaked into a Redis-cached chat answer because the model split it across two stream chunks, so the per-delta regex strip never matched a full pattern. The fix adds a cleanup pass on the joined answer right before caching. Lesson: any regex run per-chunk is blind to split patterns, so sanitize at the last point before persistence.
#sse#streaming#regex - 15:39ai
That Time a Control Flag Showed Up in the Chat Bubble
A raw CTA_FLAG: YES marker leaked into a live chat bubble. The strip regex only matched end-of-string, and the SSE stream bypassed it entirely.
TL;DR: A CTA_FLAG marker leaked into the UI because the model ignored placement instructions and SSE streaming sent chunks before the strip regex ran. The fix moved CTA data into a structured field on the knowledge source, rendered directly by the frontend. Lesson: never parse UI-critical data out of model prose; use structured fields.
#llm#streaming#sse - 16:38ai
One SSE Stream, Two AI Answers
A chatbot needs both a quick summary and a full explanation from one LLM generation. The answer: marker-based splitting in the SSE stream, with separate cache storage and mid-stream parsing.
#sse#ai#streaming - 12:55frontend
Search Dialog to AI Thread: One Array, Seven useState Gone
Follow-up questions wiped the previous answer. One ThreadEntry array with functional updates turned the single-slot dialog into a real thread.
#react#nextjs#sse - 12:28ai
Asking AI on My Blog: SSE Streaming Through Plain fetch
EventSource can't POST. The blog's Ask AI answers run through a plain fetch, a hand-rolled SSE parser, and one CRLF trap worth remembering.
#sse#fastapi#nextjs