Streaming markdown (#1920)

We wait until we have an entire newline, then format it with markdown and stream in to the UI. This reduces time to first token but is the right thing to do with our current rendering model IMO. Also lets us add word wrapping!
This commit is contained in:
easong-openai authored and GitHub committed 2025-08-07 18:26:47 -07:00
1 parent fa0051190b
commit 2b7139859e
14 files changed
+1940 -481

No files matched your search

+9 -3
View File
@@ -504,11 +504,17 @@ async fn process_sse<S>(
| "response.in_progress"
| "response.output_item.added"
| "response.output_text.done"
| "response.reasoning_summary_part.added"
| "response.reasoning_summary_text.done" => {
// Currently, we ignore these events, but we handle them
| "response.reasoning_summary_part.added" => {
// Currently, we ignore this event, but we handle it
// separately to skip the logging message in the `other` case.
}
"response.reasoning_summary_text.done" => {
// End reasoning summary with a blank separator.
let event = ResponseEvent::ReasoningSummaryDelta("\n\n".to_string());
if tx_event.send(Ok(event)).await.is_err() {
return;
}
}
other => debug!(other, "sse event"),
}
}