diff --git a/webview-ui/src/components/chat/ReasoningBlock.tsx b/webview-ui/src/components/chat/ReasoningBlock.tsx index 3fa46df570..b8299cb595 100644 --- a/webview-ui/src/components/chat/ReasoningBlock.tsx +++ b/webview-ui/src/components/chat/ReasoningBlock.tsx @@ -2,7 +2,7 @@ import React, { useEffect, useRef, useState } from "react" import { useTranslation } from "react-i18next" import MarkdownBlock from "../common/MarkdownBlock" -import { Lightbulb } from "lucide-react" +import { Lightbulb, ChevronDown, ChevronUp } from "lucide-react" interface ReasoningBlockProps { content: string @@ -16,12 +16,14 @@ interface ReasoningBlockProps { * Render reasoning with a heading and a simple timer. * - Heading uses i18n key chat:reasoning.thinking * - Timer runs while reasoning is active (no persistence) + * - Content can be toggled to show/hide */ export const ReasoningBlock = ({ content, isStreaming, isLast }: ReasoningBlockProps) => { const { t } = useTranslation() const startTimeRef = useRef(Date.now()) const [elapsed, setElapsed] = useState(0) + const [isCollapsed, setIsCollapsed] = useState(false) // Simple timer that runs while streaming useEffect(() => { @@ -36,12 +38,24 @@ export const ReasoningBlock = ({ content, isStreaming, isLast }: ReasoningBlockP const seconds = Math.floor(elapsed / 1000) const secondsLabel = t("chat:reasoning.seconds", { count: seconds }) + const handleToggle = (e: React.MouseEvent) => { + e.stopPropagation() + setIsCollapsed(!isCollapsed) + } + return (
-
+
{t("chat:reasoning.thinking")} + {isCollapsed ? ( + + ) : ( + + )}
{elapsed > 0 && ( @@ -49,7 +63,7 @@ export const ReasoningBlock = ({ content, isStreaming, isLast }: ReasoningBlockP )}
- {(content?.trim()?.length ?? 0) > 0 && ( + {!isCollapsed && (content?.trim()?.length ?? 0) > 0 && (