Enhance inline thinking blocks with reasoning summaries for GPT-5 content#1
Conversation
Co-authored-by: bastikohn <673521+bastikohn@users.noreply.github.com>
Co-authored-by: bastikohn <673521+bastikohn@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
This PR implements a dedicated reasoning summaries view in the OpenCode TUI application to display GPT-5 thinking content in a focused, split-screen interface alongside regular chat messages.
- Adds a new
ReasoningViewcomponent for displaying AI reasoning content in an organized format - Integrates the reasoning view with the existing TUI layout system using a split-screen approach
- Updates the
/thinkingcommand to control both inline blocks and the new dedicated reasoning view
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| packages/tui/internal/tui/tui_reasoning_view.go | Core implementation of the ReasoningView component with reasoning summary extraction and rendering |
| packages/tui/internal/tui/tui_reasoning_view_test.go | Unit tests for reasoning view functionality including summary extraction and text processing |
| packages/tui/internal/tui/tui.go | Integration of reasoning view into main TUI model with split layout and update handling |
| packages/tui/internal/commands/command.go | Updated command description to reflect "reasoning summaries" functionality |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| // Only get reasoning from the last assistant message for focused view | ||
| if assistantMsg.Time.Completed == 0 { | ||
| break | ||
| } |
There was a problem hiding this comment.
This logic has a potential bug - the break condition only applies when assistantMsg.Time.Completed == 0, but the loop continues processing messages even after finding incomplete assistant messages. This could skip reasoning parts from newer messages. Consider breaking when finding any incomplete message or restructuring to process messages in reverse order.
| // Only get reasoning from the last assistant message for focused view | |
| if assistantMsg.Time.Completed == 0 { | |
| break | |
| } | |
| // Only get reasoning from the most recent assistant message for focused view | |
| break |
| longText := make([]byte, 600) | ||
| for i := range longText { | ||
| longText[i] = 'a' | ||
| } | ||
| longTextStr := string(longText) |
There was a problem hiding this comment.
This manual byte slice creation can be simplified using strings.Repeat(). Replace lines 117-120 with: longTextStr := strings.Repeat(\"a\", 600).
| longText := make([]byte, 600) | |
| for i := range longText { | |
| longText[i] = 'a' | |
| } | |
| longTextStr := string(longText) | |
| longTextStr := strings.Repeat("a", 600) |
| // Show reasoning view alongside messages in a split layout | ||
| messagesWidth := effectiveWidth / 2 |
There was a problem hiding this comment.
[nitpick] The 50/50 split layout is hardcoded. Consider making the split ratio configurable or dynamic based on content length to provide better user experience with varying reasoning content sizes.
| // Show reasoning view alongside messages in a split layout | |
| messagesWidth := effectiveWidth / 2 | |
| // Dynamically calculate split ratio based on content height | |
| messagesHeight := lipgloss.Height(messagesView) | |
| reasoningHeight := lipgloss.Height(reasoningView) | |
| var splitRatio float64 | |
| totalHeight := messagesHeight + reasoningHeight | |
| if totalHeight == 0 { | |
| splitRatio = 0.5 | |
| } else { | |
| splitRatio = float64(messagesHeight) / float64(totalHeight) | |
| // Clamp splitRatio between 0.2 and 0.8 for reasonable UI | |
| if splitRatio < 0.2 { | |
| splitRatio = 0.2 | |
| } else if splitRatio > 0.8 { | |
| splitRatio = 0.8 | |
| } | |
| } | |
| messagesWidth := int(float64(effectiveWidth) * splitRatio) |
|
@copilot I did not want a split screen layout. Integrate the thinking summaries in the in-line thinking blocks. Please update the implementation accordingly. |
Co-authored-by: bastikohn <673521+bastikohn@users.noreply.github.com>
I've integrated the reasoning summaries into the inline thinking blocks as requested. The split-screen layout has been removed and reasoning content now appears inline within the message flow. The summaries include status indicators (● for active thinking, ✓ for completed reasoning) and automatically truncate long content to maintain readability. Commit: 8dcc125
Updated! The reasoning summaries are now integrated directly into the inline thinking blocks instead of using a separate split-screen layout. The implementation enhances the existing thinking blocks with summary formatting, status indicators, and automatic text truncation while maintaining the familiar inline display. Commit: 8dcc125 |
This PR enhances the existing inline thinking blocks functionality in the OpenCode TUI to display GPT-5 reasoning content with improved formatting and status indicators.
Overview
The TUI previously supported basic inline thinking blocks via the
/thinkingcommand, but lacked enhanced formatting for AI reasoning content. This implementation improves the existing inline thinking blocks to provide better presentation of reasoning summaries without introducing a separate view.Key Features
🎯 Enhanced Inline Thinking Blocks
●for active thinking and✓ Reasoning Summaryfor completed reasoning🔄 Seamless Integration
/thinkingcommand and<leader>bkeybinding functionalityImplementation Details
The enhancement processes
ReasoningPartcontent from assistant messages and displays them inline with:Usage
Users continue to use the same familiar commands:
/thinkingcommand - toggles enhanced inline thinking blocks<leader>bkeybinding - keyboard shortcut for quick accessWhen activated, reasoning content appears as enhanced inline thinking blocks within the normal message flow, providing a focused way to review AI reasoning without disrupting the conversation context.
Testing
All existing functionality preserved with enhanced presentation. The implementation maintains the same toggle behavior while providing improved visual formatting for reasoning content.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.