Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

improvement: add stop button in chat sidebar (#4893)

Myles Scolnick8dcdfa3f36c0
diff --git a/frontend/src/components/chat/chat-panel.tsx b/frontend/src/components/chat/chat-panel.tsx
index bbcb921a11..16d8592ea6 100644
--- a/frontend/src/components/chat/chat-panel.tsx
+++ b/frontend/src/components/chat/chat-panel.tsx
@@ -258,8 +258,9 @@ const ChatPanelBody = () => {
append,
handleSubmit,
error,
- isLoading,
+ status,
reload,
+ stop,
} = useChat({
keepLastMessageOnError: true,
// Throttle the messages and data updates to 100ms
@@ -293,6 +294,8 @@ const ChatPanelBody = () => {
},
});
+ const isLoading = status === "submitted" || status === "streaming";
+
const createNewThread = (initialMessage: string) => {
const newChat: Chat = {
id: generateUUID(),
@@ -418,6 +421,14 @@ const ChatPanelBody = () => {
<div ref={messagesEndRef} />
</div>
+ {isLoading && (
+ <div className="w-full flex justify-center items-center z-20 border-t">
+ <Button variant="linkDestructive" size="sm" onClick={stop}>
+ Stop
+ </Button>
+ </div>
+ )}
+
{messages && messages.length > 0 && (
<ChatInput
input={input}