Stream to Show, Store to Remember

assembling and saving the draft

Part of: Streaming Writing Assistant

Streaming is a display trick. It changes what the user sees while the reply is generated, but on its own it does nothing to remember what got written. If your writing assistant needs a "continue this draft" or "regenerate" button, you need the complete text saved somewhere the moment the stream ends, not just painted onto the screen and forgotten. Two separate jobs - Stream to show : append each delta to the page as it arrives, so the user watches the draft appear live. - Store to remember : once the stream finishes, take the full assembled text and save it into a history list, a database row, a file, whatever your app needs next. full reply is built the same way as lesson 3's reconstruct: concatenate deltas, in order, no separators. The printing and the accumulating happen in the same loop, but they do different jobs. One is for the user's eyes, one is for your data. Why a writing assistant especially needs this A summarizer or chatbot needs history so the model remembers earlier turns. A writing assistant needs it for a slightly different reason: users iterate. "Make the second paragraph shorter," "give me a punchier opening", these follow-ups only make sense if the assistant can

Challenge: Assemble and Append the Draft