mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-20 15:33:54 +00:00
docs(desktop): correct streaming-repair comments after the defer/smooth swap
the parseIncompleteMarkdown comment implied the reveal frontier is repaired; repair runs on the full accumulated text, so reword it to say that. drop the now-dead "multiple surfaces render the same content" clause from the block-cache comment (the smooth and defer wrappers that caused it were removed), and trim the math-preprocess comment to the load-bearing prose-only constraint.
This commit is contained in:
parent
673a61edc8
commit
9eb89b8a12
2 changed files with 8 additions and 10 deletions
|
|
@ -62,8 +62,7 @@ function preprocessWithTailRepair(text: string): string {
|
|||
// Memoized block splitter. Streamdown calls `parseMarkdownIntoBlocks` (a full
|
||||
// `marked` lex of the entire message, ~1.6ms per 28KB) inside a useMemo keyed
|
||||
// on the text — but the same text is re-lexed every time a message REMOUNTS
|
||||
// (virtualizer scroll, session switch) and whenever multiple surfaces render
|
||||
// the same content (remount, session switch). A small module-level
|
||||
// (virtualizer scroll, session switch). A small module-level
|
||||
// LRU keyed by the exact source string removes all of those repeat parses
|
||||
// with zero correctness risk (same input → same output). Streaming tail
|
||||
// growth misses the cache by design (every flush is a new string) — that
|
||||
|
|
@ -523,10 +522,11 @@ function MarkdownTextSurface({ containerClassName, containerProps, defer, smooth
|
|||
defer={defer}
|
||||
lineNumbers={false}
|
||||
mode="streaming"
|
||||
// The built-in tail-bounded remend is disabled when a custom
|
||||
// parseMarkdownIntoBlocksFn is supplied, so repair runs in
|
||||
// preprocessWithTailRepair instead. parseIncompleteMarkdown stays
|
||||
// false to avoid a second full-text remend pass.
|
||||
// Incomplete-markdown repair runs in preprocessWithTailRepair on the
|
||||
// full accumulated text; the built-in tail-bounded remend is disabled
|
||||
// because a custom parseMarkdownIntoBlocksFn is supplied, and
|
||||
// parseIncompleteMarkdown stays false to avoid a second full-text
|
||||
// remend pass.
|
||||
parseIncompleteMarkdown={false}
|
||||
parseMarkdownIntoBlocksFn={parseMarkdownIntoBlocksCached}
|
||||
plugins={plugins}
|
||||
|
|
|
|||
|
|
@ -344,10 +344,8 @@ export function preprocessMarkdown(text: string): string {
|
|||
const leading = part.match(/^\s*/)?.[0] ?? ''
|
||||
const trailing = part.match(/\s*$/)?.[0] ?? ''
|
||||
|
||||
// normalizeMathDelimiters rewrites LaTeX bracket delimiters and
|
||||
// custom math tags to dollar form. escapeCurrencyDollars escapes
|
||||
// `$<digit>` so currency isn't eaten as math. Both run only on
|
||||
// prose segments so code blocks stay untouched.
|
||||
// Run only on prose segments so `$5` literals and `\(` inside code
|
||||
// blocks stay intact.
|
||||
const transformed = normalizeVisibleProse(
|
||||
stripPreviewTargets(normalizeMathDelimiters(escapeCurrencyDollars(part)))
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue