mirror of
https://github.com/earendil-works/pi.git
synced 2026-06-18 15:54:04 +08:00
Show "Aborted" text when aborting text generation during streaming
Update streaming component with final message in message_end event. The final message includes the stopReason, which allows the component to render "Aborted" text for aborted text generation. Now behavior is consistent: - Abort during text generation (no tool calls) → shows red "Aborted" - Abort during tool call streaming → tool components turn red
This commit is contained in:
@@ -215,6 +215,9 @@ export class TuiRenderer {
|
||||
if (this.streamingComponent && event.message.role === "assistant") {
|
||||
const assistantMsg = event.message as AssistantMessage;
|
||||
|
||||
// Update streaming component with final message (includes stopReason)
|
||||
this.streamingComponent.updateContent(assistantMsg);
|
||||
|
||||
// If message was aborted or errored, mark all pending tool components as failed
|
||||
if (assistantMsg.stopReason === "aborted" || assistantMsg.stopReason === "error") {
|
||||
const errorMessage =
|
||||
|
||||
Reference in New Issue
Block a user