Extend collapsible message UI to assistant responses and keep only the latest expanded#23
Closed
Hong-Seungmin wants to merge 6 commits into11me:masterfrom
Closed
Extend collapsible message UI to assistant responses and keep only the latest expanded#23Hong-Seungmin wants to merge 6 commits into11me:masterfrom
Hong-Seungmin wants to merge 6 commits into11me:masterfrom
Conversation
…to-responses Extend long-message collapse to assistant responses
…to-responses-eaoctu Extend collapse UI to assistant messages and start assistant responses expanded
Owner
|
Hey, thanks for PR, have you tested this manually in chrome and firefox? |
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.
Motivation
The existing message-collapsing UI was originally focused on user messages, but it needed to be extended consistently to assistant responses as well.
From a UX perspective, keeping every assistant response expanded would reduce readability and make the conversation view feel dense. To balance readability and screen efficiency, the intended behavior is to keep only the most recent assistant response expanded by default.
We also needed to make the implementation more resilient to ChatGPT DOM variations, since assistant messages do not always include
.user-message-bubble-color. This required stronger container discovery logic.Changes
COLLAPSIBLE_ROOT_SELECTORthat includes both user and assistant messages.isLatestAssistantRootandshouldStartExpanded, so that only the latest assistant root starts expanded.normalizeAssistantExpansion()to normalize assistant message states after batch processing, ensuring that only the most recent assistant response remains expanded while earlier responses are collapsed.deriveBubbleContainer(), allowing the toggle UI to be attached and removed reliably even when the bubble class is missing.Testing
npm run build:typesnpm testAdditional and updated tests were added for the following scenarios:
Notes