({
+ code: ({
+ className,
+ children,
+ ...props
+ }: ComponentProps<"code">) => {
+ const isBlock =
+ typeof className === "string" && className.includes("language-");
+ if (!isBlock) {
+ return (
+
+ {children}
+
+ );
+ }
+ return (
+
+
+ {t.toolCalls.expandContent}
+
+
+
+ {children}
+
+
+
+ );
+ },
+ }),
+ [t.toolCalls.expandContent],
+ );
return (
}
>
@@ -185,6 +219,7 @@ export function MessageGroup({
content={lastReasoningStep.reasoning ?? ""}
isLoading={isLoading}
rehypePlugins={rehypePlugins}
+ components={thinkingComponents}
/>
}
>
@@ -227,8 +262,8 @@ function ToolCall({
language?: BundledLanguage;
expanded?: boolean;
}) => {
- const shouldCollapse = content.length > TOOL_CONTENT_COLLAPSE_THRESHOLD;
- const shouldShowCodeBlock = !shouldCollapse || expanded;
+ // Always start collapsed in thinking blocks; user must explicitly expand.
+ const shouldShowCodeBlock = expanded;
return (
@@ -417,28 +452,24 @@ function ToolCall({
return t.toolCalls.executeCommand;
}
const command: string | undefined = (args as { command: string })?.command;
- const shouldCollapse =
- !!command && command.length > TOOL_CONTENT_COLLAPSE_THRESHOLD;
return (
{
- event.stopPropagation();
- setIsCommandExpanded((prev) => !prev);
- }}
- >
- {isCommandExpanded
- ? t.toolCalls.collapseContent
- : t.toolCalls.expandContent}
-
- ) : undefined
+
}
>
{command && (