Merge pull request #28829 from NousResearch/bb/tui-no-history-truncation
fix(tui): render full assistant text in scrollback (no history truncation)
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
import {
|
||||
boundedHistoryRenderText,
|
||||
boundedLiveRenderText,
|
||||
buildToolTrailLine,
|
||||
edgePreview,
|
||||
@@ -160,15 +159,6 @@ describe('boundedLiveRenderText', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('boundedHistoryRenderText', () => {
|
||||
it('uses a non-live omission label for completed history', () => {
|
||||
const out = boundedHistoryRenderText('abcdefghij', { maxChars: 4, maxLines: 10 })
|
||||
|
||||
expect(out).toContain('[showing tail; omitted')
|
||||
expect(out).not.toContain('live tail')
|
||||
})
|
||||
})
|
||||
|
||||
describe('edgePreview', () => {
|
||||
it('keeps both ends for long text', () => {
|
||||
expect(edgePreview('Vampire Bondage ropes slipped from her neck, still stained with blood', 8, 18)).toBe(
|
||||
|
||||
@@ -39,4 +39,19 @@ describe('virtual height estimates', () => {
|
||||
|
||||
expect(withSep).toBe(base + 2)
|
||||
})
|
||||
|
||||
it('caps wrapped-line counting so giant assistant turns do not block offset rebuilds', () => {
|
||||
// wrappedLines is invoked once per uncached message during
|
||||
// useVirtualHistory's offset rebuild. Unbounded counting on a long
|
||||
// assistant response (10k+ chars × every row × every rebuild) blocks
|
||||
// the UI on cold mount. Cap is ~800 rows; post-mount Yoga
|
||||
// measurement converges to the true height regardless.
|
||||
const giant = 'x'.repeat(1_000_000)
|
||||
const t0 = performance.now()
|
||||
const rows = wrappedLines(giant, 80)
|
||||
const elapsed = performance.now() - t0
|
||||
|
||||
expect(rows).toBeLessThanOrEqual(800)
|
||||
expect(elapsed).toBeLessThan(50)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user