fix(web): shorten streamed content size labels

This commit is contained in:
imccyu authored and GitHub committed 2026-10-01 00:19:52 +08:00
1 parent b7f06692b6
commit 83f9dcac8f
8 files changed
+16 -16

No files matched your search

+2 -2
View File
@@ -162,14 +162,14 @@ describe('web e2e: a git workspace turn ends with its changed files', () => {
await row.getByRole('button').waitFor()
expect(await row.locator('[aria-expanded]').count()).toBe(0)
expect(await row.locator('pre').count()).toBe(0)
expect(await row.getByText(/正在准备内容 \d+KB/).count()).toBe(0)
expect(await row.getByText(/^\d+KB$/).count()).toBe(0)
await compareOrRefreshGolden(join(DIR, `preparing-${preparation.name}.expected.md`), await row.ariaSnapshot(), MODE)
preparation.release.resolve(undefined)
await Promise.race([
preparation.contentReady.promise,
settled.then(() => { throw new Error(`No open ${preparation.name} content prefix was streamed`) }),
])
await row.getByText('正在准备内容 1KB', { exact: true }).waitFor()
await row.getByText('1KB', { exact: true }).waitFor()
expect(await row.locator('[aria-expanded]').count()).toBe(0)
expect(await row.locator('pre').count()).toBe(0)
await compareOrRefreshGolden(join(DIR, `preparing-${preparation.name}-content.expected.md`), await row.ariaSnapshot(), MODE)
@@ -89,7 +89,7 @@ export const zh = {
'tool.title.createGoal': '创建目标',
'tool.title.getGoal': '查看目标',
'tool.title.updateGoal': '更新目标',
'tool.preparing.content': '正在准备内容 {kilobytes}KB',
'tool.preparing.content': '{kilobytes}KB',
'tool.title.createSchedule': '创建定时任务',
'tool.title.listSchedules': '查看定时任务',
'tool.title.deleteSchedule': '删除定时任务',
@@ -465,7 +465,7 @@ export const en = {
'tool.title.createGoal': 'Create goal',
'tool.title.getGoal': 'View goal',
'tool.title.updateGoal': 'Update goal',
'tool.preparing.content': 'Preparing content {kilobytes}KB',
'tool.preparing.content': '{kilobytes}KB',
'tool.title.createSchedule': 'Create reminder',
'tool.title.listSchedules': 'List reminders',
'tool.title.deleteSchedule': 'Delete reminder',
+2 -2
View File
@@ -15,8 +15,8 @@
en: d152484eb41ac6b4
zh: 09388d293f9be9cb
/deepseek-ai-dsh-client-ui-tool/use-this-package:
en: b99e542d5173027c
zh: 0bc200adf2289ba0
en: ed39a00d86aa20ba
zh: 70bca2b5dc394970
/deepseek-ai-dsh-client-ui-tool/use-this-package/registering-a-business-tool-view:
en: f19e077425b8f312
zh: 24d88794be439302
+1 -1
View File
@@ -29,7 +29,7 @@ Tool calls appear in the conversation as cards: a root call tree with its nested
Shared Tool rows and Bash rows retain error and warning colors for failed and stopped summaries, including on hover. Hover darkens only summaries without those states.
Before dispatch, a named model call appears as one non-expandable row with its tool-owned icon and title. A generic row shows `Tool call · <tool name>`. Read/write/edit show an openable path once `file_path` closes and decodes without errors; write/edit also show `Preparing content NKB` after that path while content streams, never as a standalone summary. N rounds the decoded content's UTF-16 length up in units of 1024, not file bytes. Command rows show the streamed description. `tool/call` enables the existing call presentation; completing an argument block alone does not start execution.
Before dispatch, a named model call appears as one non-expandable row with its tool-owned icon and title. A generic row shows `Tool call · <tool name>`. Read/write/edit show an openable path once `file_path` closes and decodes without errors; write/edit also show `NKB` after that path while content streams, never as a standalone summary. N rounds the decoded content's UTF-16 length up in units of 1024, not file bytes. Command rows show the streamed description. `tool/call` enables the existing call presentation; completing an argument block alone does not start execution.
### Registering a business tool view
+1 -1
View File
@@ -29,7 +29,7 @@ kind: "package-reference"
共享工具行和 Bash 行的失败、停止摘要在悬停时仍保留错误色和警告色;只有不处于这两种状态的摘要会在悬停时加深。
派发前,模型已给出名称的调用显示为不可展开的一行,使用工具自己的图标与标题。通用行显示为 `工具调用 · <工具名>`。read/write/edit 在 `file_path` 闭合且解码无误后显示可打开的路径;write/edit 在内容流入时还在该路径后显示「正在准备内容 NKB」,不将它单独作为摘要。N 按解码后内容的 UTF-16 长度除以 1024 向上取整,不是文件字节数。命令行显示流入中的描述。`tool/call` 才启用既有调用展示;参数块结束本身不代表开始执行。
派发前,模型已给出名称的调用显示为不可展开的一行,使用工具自己的图标与标题。通用行显示为 `工具调用 · <工具名>`。read/write/edit 在 `file_path` 闭合且解码无误后显示可打开的路径;write/edit 在内容流入时还在该路径后显示 `NKB`,不将它单独作为摘要。N 按解码后内容的 UTF-16 长度除以 1024 向上取整,不是文件字节数。命令行显示流入中的描述。`tool/call` 才启用既有调用展示;参数块结束本身不代表开始执行。
### 注册业务工具视图
@@ -66,7 +66,7 @@ describe('tool preparation', () => {
const args = new PartialArguments()
args.append(`{"${field}":"hello`)
const view = render(<FileMutationRow {...preparation(name, args)} />)
expect(view.queryByText('Preparing content 1KB')).toBeNull()
expect(view.queryByText('1KB')).toBeNull()
expect(view.queryByRole('button')).toBeNull()
})
@@ -81,11 +81,11 @@ describe('tool preparation', () => {
args.append('.txt"')
view.rerender(<FileMutationRow {...props} block={{ ...props.block }} />)
expect(view.getByText('hello.txt')).toBeTruthy()
expect(view.queryByText('Preparing content 1KB')).toBeNull()
expect(view.queryByText('1KB')).toBeNull()
args.append(',"content":"hello')
view.rerender(<FileMutationRow {...props} block={{ ...props.block }} />)
expect(view.getByText('hello.txt')).toBeTruthy()
expect(view.getByText('Preparing content 1KB')).toBeTruthy()
expect(view.getByText('1KB')).toBeTruthy()
fireEvent.click(view.getByText('hello.txt'))
expect(props.openFile).toHaveBeenCalledWith('hello.txt')
const started: StartedToolCall = {
@@ -97,7 +97,7 @@ describe('tool preparation', () => {
expect(row).toBe(preparingRow)
expect(view.getByText('hello.txt')).toBeTruthy()
expect(view.container.querySelector('[data-state="running"]')).not.toBeNull()
expect(view.queryByText('Preparing content 1KB')).toBeNull()
expect(view.queryByText('1KB')).toBeNull()
const result: ToolResultNode = {
kind: 'tool-result', seq: 3, time: 3, callId: 'call', callTime: 2,
name: 'write', args: PartialArguments.fromText(started.argsRaw),
@@ -141,13 +141,13 @@ describe('tool preparation', () => {
args.append(`{"file_path":"hello.txt","old_string":"${'a'.repeat(600)}","new_string":"`)
const props = preparation('edit', args)
const view = render(<FileMutationRow {...props} />)
expect(view.getByText('Preparing content 1KB')).toBeTruthy()
expect(view.getByText('1KB')).toBeTruthy()
args.append('b'.repeat(424))
expect(args.refresh()).toBe(false)
args.append('b')
expect(args.refresh()).toBe(true)
view.rerender(<FileMutationRow {...props} block={{ ...props.block }} />)
expect(view.getByText('Preparing content 2KB')).toBeTruthy()
expect(view.getByText('2KB')).toBeTruthy()
})
it('shows a streamed Bash description without enabling expansion', () => {
@@ -1,3 +1,3 @@
- text: 正在准备调用 编辑
- button "intro.md"
- text: 正在准备内容 1KB
- text: 1KB
@@ -1,3 +1,3 @@
- text: 正在准备调用 写入
- button "src/util.ts"
- text: 正在准备内容 1KB
- text: 1KB