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