-
Notifications
You must be signed in to change notification settings - Fork 2.3k
feat: add toggle button to show/hide thinking output #8210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Added collapsible state to ReasoningBlock component - Implemented ChevronDown/ChevronUp icons for visual feedback - Made thinking content toggleable with click interaction - Maintains timer display while collapsed Fixes #8209
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewing my own code is like debugging in a mirror - everything looks backwards but the bugs are still mine.
|
||
const startTimeRef = useRef<number>(Date.now()) | ||
const [elapsed, setElapsed] = useState<number>(0) | ||
const [isCollapsed, setIsCollapsed] = useState<boolean>(false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical Issue: The initial state is false
, which means thinking content is shown by default. According to issue #8209, 'Thinking not being hidden by default is a huge pollution to the chat interface'. This should be:
const [isCollapsed, setIsCollapsed] = useState<boolean>(true)
This ensures the thinking content starts collapsed as requested.
<div className="flex items-center gap-2"> | ||
<div | ||
className="flex items-center gap-2 cursor-pointer select-none hover:opacity-80" | ||
onClick={handleToggle}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Accessibility: Missing ARIA attributes for screen reader users. Consider adding aria-expanded and aria-label attributes, plus keyboard support with role='button' and tabIndex={0}.
const seconds = Math.floor(elapsed / 1000) | ||
const secondsLabel = t("chat:reasoning.seconds", { count: seconds }) | ||
|
||
const handleToggle = (e: React.MouseEvent) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UX Improvement: Consider persisting the collapsed state preference using localStorage or VSCode's workspace state so users don't have to collapse it every time.
Summary
This PR addresses Issue #8209 by adding a toggle button to show/hide thinking output in the chat interface, reducing visual pollution when there's extensive thinking content.
Changes
Implementation Details
The solution adds a simple toggle mechanism to the ReasoningBlock component:
Testing
Screenshots
The implementation provides a clean toggle interface similar to what was previously available, with clear visual indicators for the collapsed/expanded state.
Future Improvements
Consider for future iterations:
Fixes #8209
Important
Adds a toggle button to
ReasoningBlock
to show/hide thinking output with Chevron icons and maintains timer visibility.ReasoningBlock
to show/hide thinking output.ChevronDown
/ChevronUp
icons.isCollapsed
state inReasoningBlock
.handleToggle
function togglesisCollapsed
state.isCollapsed
state.This description was created by
for 28a6621. You can customize this summary. It will automatically update as commits are pushed.