feat(chat): refactor agent stream display and tool result rendering

Add RagPipelineProgress timeline, simplify AgentStreamDisplay structure,
group grep hits per document, and add KnowledgeChunksList tool result UI.
This commit is contained in:
wizardchen
2026-06-16 00:49:44 +08:00
committed by lyingbug
parent 05f39b859f
commit c6f1b54f73
25 changed files with 2832 additions and 1781 deletions
@@ -0,0 +1,26 @@
import assert from 'node:assert/strict'
import test from 'node:test'
import { getKnowledgeChunksSummaryHtml } from './knowledgeChunksDisplay.ts'
const t = (key, params) => {
if (key === 'agentStream.knowledgeChunksList.chunkRange') {
return `loaded ${params?.fetched}/${params?.total}`
}
if (key === 'agentStream.knowledgeChunksList.page') {
return `page ${params?.page}/${params?.pageSize}`
}
return key
}
test('getKnowledgeChunksSummaryHtml joins chunk range and page', () => {
const html = getKnowledgeChunksSummaryHtml(t, {
display_type: 'knowledge_chunks_list',
fetched_chunks: 20,
total_chunks: 282,
page: 3,
page_size: 20,
})
assert.match(html, /loaded <strong>20<\/strong>\/<strong>282<\/strong>/)
assert.match(html, /page 3\/20/)
})