fix(dashboard): treat transcript text output as markdown or json only#462
Merged
Conversation
Prose sections in parseMarkdownBlocks were using the broad detectLanguage heuristic, which could return xml/html/typescript/shellscript. When classified as xml or html, the prose was rendered through StructuredMarkup (the collapsible XML tree) instead of HighlightedCode, breaking syntax highlighting for normal LLM chat output. Changes: - Add detectOutputLanguage: returns only 'json' (valid JSON/JSONL) or 'markdown' for LLM text output; no XML/TS/shell heuristics - Update parseMarkdownBlocks to use detectOutputLanguage for all prose sections, keeping broad detectLanguage only for the raw debug view - Add fenced: boolean to CodeBlock so canRenderStructuredMarkup can gate structured XML/HTML rendering on explicit fence provenance - canRenderStructuredMarkup now accepts CodeBlock and requires fenced===true; auto-detected prose is never eligible regardless of language - ThinkingPartView switches to detectOutputLanguage (LLM reasoning output) - raw message view keeps broad detectLanguage (debug/developer view) - 13 new format tests covering all prose language scenarios and the structured markup eligibility invariant Fixes: XML markers in raw LLM output no longer trigger the collapsible structured markup renderer. Co-authored-by: David Cramer <noreply>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
What
Prose sections in
parseMarkdownBlocksused the broaddetectLanguageheuristic, which could returnxml,html,typescript, orshellscript. When classified asxml/html, prose was rendered throughStructuredMarkup(the collapsible XML tree) instead ofHighlightedCode, breaking syntax highlighting for normal LLM chat output.Changes
detectOutputLanguage(new export): returns onlyjson(valid JSON/JSONL) ormarkdownfor LLM text output — no XML/TS/shell heuristicsparseMarkdownBlocks: usesdetectOutputLanguagefor all prose sections; broaddetectLanguageis kept only for the raw debug viewCodeBlock.fenced(new field on type):truefor explicit code fences,falsefor prose; gates structured XML/HTML rendering on provenance, not just languagecanRenderStructuredMarkup: now acceptsCodeBlockand requiresfenced === true; auto-detected prose is never eligible regardless of languageThinkingPartView: switched todetectOutputLanguage(also LLM-generated output)detectLanguage(developer/debug surface)Verified
tsc --noEmit: cleanvitest run tests/format.test.ts: 17/17 passingView Session in Sentry
Action taken on behalf of David Cramer.