fix(webui): keep stop immediate without command metadata
This commit is contained in:
1 parent
5cf629963d
commit
24a5c6dd56
3 files changed
+19
-1
No files matched your search
@@ -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. Paths
|
||||
follow 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 new
|
||||
conversation. To discuss that directory, write `/new/` or `Look at /new`.
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in new issue
Block a user