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:
@@ -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"),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user