Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions src/tui/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import { ConversationPanel } from "./conversationPanel.js";
import { StatusBar } from "./statusBar.js";
import { InputPanel } from "./inputPanel.js";
import { isStreamingMessage } from "./messages.js";

Check failure on line 8 in src/tui/app.js

View workflow job for this annotation

GitHub Actions / lint

eslint(no-unused-vars)

Identifier 'isStreamingMessage' is imported but never used.
import { Banner } from "./banner.js";
import { OnboardingPanel } from "./onboardingPanel.js";
import { createSession } from "../session/factory.js";
Expand Down Expand Up @@ -898,14 +898,11 @@
if (sessionState) {
sessionState.popExchange();
}
// Clear the partial streaming assistant message from UI
setMessages((prev) => prev.filter((msg) => !isStreamingMessage(msg)));
setStatusMessage("Interrupted.");
} else {
if (onSaveSession) {
onSaveSession();
}
setMessages((prev) => prev.filter((msg) => !isStreamingMessage(msg)));
setStatusMessage("Something went wrong");
addMessage({
role: "system",
Expand Down Expand Up @@ -937,14 +934,9 @@
abortControllerRef.current = null;
}
isStreamingRef.current = false;
setMessages((prev) => {
const cloned = [...prev];
const last = cloned[cloned.length - 1];
if (last?.role === "assistant" && last?.streaming) {
last.streaming = false;
}
return cloned;
});
// Don't modify the message array here — the server's 400 response
// can corrupt state when we mutate messages during abort. The
// AbortError catch block in handleChat/handleCommand cleans up.
setStatusMessage("Interrupted.");

// Wait for the dispatchProvider promise to resolve (it will throw
Expand Down
Loading