fix(codeBlock): 修复代码块抖动的问题

This commit is contained in:
肖应宇 2026-04-16 17:10:05 +08:00
parent 9758ae8a3a
commit e3b54e8301
1 changed files with 5 additions and 2 deletions

View File

@ -263,8 +263,9 @@ function ToolCall({
language?: BundledLanguage; language?: BundledLanguage;
expanded?: boolean; expanded?: boolean;
}) => { }) => {
// Always start collapsed in thinking blocks; user must explicitly expand. // During streaming, never render code block content in thinking area.
const shouldShowCodeBlock = expanded; // Code is only available for expand/collapse after streaming is complete.
const shouldShowCodeBlock = !isLoading && expanded;
return ( return (
<div className="space-y-1"> <div className="space-y-1">
@ -462,8 +463,10 @@ function ToolCall({
<Button <Button
className="h-7 px-3 text-xs" className="h-7 px-3 text-xs"
variant="ghost" variant="ghost"
disabled={isLoading}
onClick={(event) => { onClick={(event) => {
event.stopPropagation(); event.stopPropagation();
if (isLoading) return;
setIsCommandExpanded((prev) => !prev); setIsCommandExpanded((prev) => !prev);
}} }}
> >