fix: only animate the hidden-thinking Text label, not Markdown replies - #4
Open
noctuid wants to merge 1 commit into
Open
fix: only animate the hidden-thinking Text label, not Markdown replies#4noctuid wants to merge 1 commit into
noctuid wants to merge 1 commit into
Conversation
The thinking-label patch matched any child with a setText method whose text contained 'Thinking'. Markdown components (used to render the assistant text reply) also expose setText/.text, so any assistant reply mentioning 'Thinking' was overwritten with a one-line animation frame, making the reply disappear when thinking blocks were hidden. Restrict the match to Text instances, matching the code's stated intent.
Author
|
Uh, my agent decided to fork and open a PR without any instruction to 😆. It looks like it works though. There is a bug currently where if you hide thinking, normal assistant replies are hidden as well. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When thinking blocks are hidden (
C-t), any assistant text reply that happened to contain the word "Thinking" would disappear entirely, replaced by a one-line animation frame.Root cause
The
AssistantMessageComponent.updateContentmonkey-patch matches the hidden-thinking label like this:The match uses duck typing (
setText+.textincludes "Thinking"). ButMarkdowncomponents — which render the assistant's text reply — also exposesetTextand.text(seemarkdown.tsin pi-tui). So an assistant reply mentioning "Thinking" (e.g. "Let me think about this…") is overwritten with a one-line shimmer frame, hiding the whole reply.Fix
Restrict the match to
Textinstances, which is what the code comment already says it intends ("Find Text components with 'Thinking...'"):Textis already imported. The hidden-thinking label is created asnew Text(...), while assistant replies arenew Markdown(...), soinstanceof Textcleanly distinguishes them.@mariozechner/pi-tuiis aliased to the same module as@earendil-works/pi-tui, so the class identity check is reliable.Testing
C-t) on a conversation where an assistant reply contains the word "Thinking".