Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
fix(webui): keep stop immediate without command metadata
Xubin Ren24a5c6dd5667
diff --git a/docs/chat-commands.md b/docs/chat-commands.mdindex 232c8980b..64c07a9dd 100644--- a/docs/chat-commands.md+++ b/docs/chat-commands.md@@ -41,6 +41,8 @@ Use `/help` or the command menu to find a command.In the WebUI, Enter queues ordinary text while a response is running. Pathsfollow the same rule. Registered commands still go to the gateway immediately.+If the command list is unavailable, slash-prefixed input goes to the gateway+immediately, so commands such as `/stop` do not wait in the queue.A path can have the same name as a command. For example, `/new` starts a newconversation. To discuss that directory, write `/new/` or `Look at /new`.diff --git a/webui/src/components/thread/ThreadComposer.tsx b/webui/src/components/thread/ThreadComposer.tsxindex b48345eca..96a9cb39c 100644--- a/webui/src/components/thread/ThreadComposer.tsx+++ b/webui/src/components/thread/ThreadComposer.tsx@@ -1200,7 +1200,10 @@ export function ThreadComposer({&& !encoding&& !hasErrors&& hasComposerContent- && !isRegisteredSlashCommand(value, slashCommands);+ // Without command metadata, let the gateway classify slash input immediately.+ && (slashCommands.length > 0+ ? !isRegisteredSlashCommand(value, slashCommands)+ : !value.trimStart().startsWith("/"));const slashQuery = useMemo(() => {if (interactionDisabled || slashMenuDismissed || !value.startsWith("/")) return null;diff --git a/webui/src/tests/thread-composer.test.tsx b/webui/src/tests/thread-composer.test.tsxindex 1b3dc3bea..56dc909f9 100644--- a/webui/src/tests/thread-composer.test.tsx+++ b/webui/src/tests/thread-composer.test.tsx@@ -2929,6 +2929,19 @@ describe("ThreadComposer", () => {expect(onSend).toHaveBeenCalledWith("/status", undefined, undefined);});+ it("sends a possible stop command without waiting when command metadata is unavailable", () => {+ const onSend = vi.fn();+ const onStop = vi.fn();+ render(<ThreadComposer onSend={onSend} onStop={onStop} isStreaming />);+ const input = screen.getByLabelText("Message input");+ fireEvent.change(input, { target: { value: "/stop" } });+ fireEvent.keyDown(input, { key: "Enter" });++ expect(onSend).toHaveBeenCalledWith("/stop", undefined, { continueActiveTurn: true });+ expect(onStop).not.toHaveBeenCalled();+ expect(screen.queryByRole("group", { name: "Waiting to send" })).not.toBeInTheDocument();+ });+it("marks new chat commands as side-channel sends that finalize the active turn", () => {const onSend = vi.fn();render(