Repository navigation
feat: render an assistant message with its sources, checks and failure states - #558
Merged
Merged
Conversation
|
Automatic reviews are disabled for this repository. |
|
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
An answer needs its sources, its grounding checks and its failure states shown next to the text, and a stored message can come back from
sessionStoragewith nested fields in any shape.Change
Adds
AssistantMessage. A user message renders as plain text, never as markdown; an assistant message renders throughAssistantMarkdown, which gets the source numbers only once the turn isdone, so a citation in a streaming, cut, stopped or failed answer stays plain text instead of reading as a missing source. Sources show as compact rows[n] Title · Section(no separator when the section is empty) with the anchor id the citations point at; a row is a button, and only one row is open at a time, showing the snippet as a text node when there is one, the layer, and for a public source with anhttps:URL a link opening in a new tab withrel="noopener noreferrer". A local source never links and carries a "Local copy" badge. Clicking a citation opens its row and scrolls to it once it has opened.numbers_grounded: falseandcitations_valid: falseeach add one amber line, the first listing the unconfirmed numbers when there are any; the tools the assistant used show as one muted line, with an unknown tool name shown as is. Anerrorturn shows fixed text chosen by its status code (429 with minutes whenretryAfteris a positive number, 503, 404, anything else), never the error detail; acutturn keeps its partial text muted with an "interrupted" block, and acutwith blank text shows the block without the line that points at the partial text; acancelledturn shows a "Stopped" note, with the partial-answer line only when there is text. An optionalonRetryadds a "Try again" button to the red block.message-shape.tsre-checkssources,toolsUsedandchecksand drops what does not fit. Code blocks keep their line breaks; the allowlist from the previous PR dropspre. Newmessage.*strings in en and cs.Verification
New tests in
AssistantMessage.test.tsxandmessage-shape.test.tscover public,http:,javascript:and local sources, the one-open-row rule, citations opening their row, malformed nested fields, both checks lines in both directions, known and unknown tools, each error code without the detail,cutwith and without text, anerrorwith partial text, whitespace-only content, a snippet holding HTML,cancelled,onRetry, and a user message not read as markdown.AssistantMarkdown.test.tsxgains cases for adjacent citations, a citation opening the line, and the citation anchor node surviving appended content.npm run lint,npm run typecheck,npm run test:coverage,./scripts/ci/ci-local.sh lintand./scripts/ci/ci-local.sh testare green.Migrations
None.
Screenshots
None, the panel wires the component in a later PR.