fix(webui): keep slash commands out of streaming state

This commit is contained in:
chengyongru
2026-07-07 15:42:04 +08:00
committed by Xubin Ren
parent 0f88927364
commit 8f68040f05
6 changed files with 318 additions and 59 deletions
+12 -1
View File
@@ -1480,7 +1480,17 @@ export function ThreadComposer({
...(attachedMcpPresets.length > 0 ? { mcpPresets: attachedMcpPresets } : {}),
}
: undefined;
onSend(content, payload, options);
const commandName = content.split(/\s+/, 1)[0];
const isSlashSideChannel =
payload === undefined
&& attachedCliApps.length === 0
&& attachedMcpPresets.length === 0
&& visibleSlashCommands.some((command) => command.command === commandName);
onSend(
content,
payload,
isSlashSideChannel ? { ...options, sideChannel: true } : options,
);
setQueuedPrompts([]);
// Bubble owns the data URL copy; safe to revoke every staged blob
// preview here without affecting the rendered message.
@@ -1497,6 +1507,7 @@ export function ThreadComposer({
onSend,
readyImages,
value,
visibleSlashCommands,
]);
const onKeyDown = (e: ReactKeyboardEvent<HTMLTextAreaElement>) => {
@@ -455,6 +455,13 @@ export const ThreadViewport = forwardRef<ThreadViewportHandle, ThreadViewportPro
measureComposerDock();
}, [composer, hasMessages, measureComposerDock]);
useLayoutEffect(() => {
if (!hasMessages || userReadingHistoryRef.current) return;
const promptId = activeTurnPromptRef.current;
if (promptId && scrollToPromptTopNow(promptId)) return;
scrollToBottom(false, 2);
}, [composerDockHeight, hasMessages, scrollToBottom, scrollToPromptTopNow]);
useEffect(() => cancelScheduledBottomScroll, [cancelScheduledBottomScroll]);
useEffect(() => {