fix(ui-chat): map legacy normal work details to detailed

This commit is contained in:
imccyu committed 2026-09-27 11:43:09 +08:00
1 parent 2fc10a41c4
commit a03e63d1e3
6 files changed
+18 -13

No files matched your search

+1 -1
View File
@@ -15,7 +15,7 @@ export const TRANSCRIPT_VIEW_MODES = ['compact', 'standard', 'detailed', 'verbos
export type TranscriptViewMode = typeof TRANSCRIPT_VIEW_MODES[number]
/**
* Saved value from the two-mode generation of this setting. Read as `standard`;
* Saved value from the two-mode generation of this setting. Read as `detailed`;
* never offered as a choice and never written back.
*/
export const LEGACY_TRANSCRIPT_VIEW_MODE = 'normal'
@@ -27,8 +27,8 @@
en: 8db4991626210708
zh: e18c8aa3cb434980
/chat-conversation-node-rules/display-modes:
en: 42342a06ef189075
zh: 1a554b50125fcdda
en: b67a97af6578be4e
zh: 45511f59d45746fe
/chat-conversation-node-rules/display-modes/group-title-rules:
en: a6d29a5ea3fd2362
zh: dbd07bf82cdd61b1
@@ -108,7 +108,7 @@ Automatic collapse keeps the process open if hiding it would hide keyboard focus
<a id="display-modes"></a>
## Display modes
Settings → General → Work details offers `compact`, `standard` (default), `detailed`, and `verbose`; its description is “Choose how much detail to show for tool calls”. A saved `normal` reads as `standard`, and a saved `expanded` reads as `detailed`, without automatic write-back. Existing `detailed` remains `detailed`. Missing or invalid values, including the period before Host settings arrive, use `standard`; invalid values in other settings still fail validation.
Settings → General → Work details offers `compact`, `standard` (default), `detailed`, and `verbose`; its description is “Choose how much detail to show for tool calls”. Saved `normal` and `expanded` values read as `detailed`, without automatic write-back. Existing `detailed` remains `detailed`. Missing or invalid values, including the period before Host settings arrive, use `standard`; invalid values in other settings still fail validation.
| Behavior | Compact | Standard | Detailed | Verbose |
|---|---|---|---|---|
@@ -108,7 +108,7 @@ description: "Chat 过程分组与活动摘要的明细业务规则。"
<a id="display-modes"></a>
## 展示模式
设置 → 通用设置 → 工作步骤展示提供 `compact`、`standard`(默认)、`detailed` 和 `verbose`,说明为「选择希望看到多少工具调用细节」。旧值 `normal` 读取为 `standard`,`expanded` 读取为 `detailed`,不自动回写;已有 `detailed` 保持不变。未配置、无效值以及 Host 设置到达前均使用 `standard`;其他设置的无效值仍会校验失败。
设置 → 通用设置 → 工作步骤展示提供 `compact`、`standard`(默认)、`detailed` 和 `verbose`,说明为「选择希望看到多少工具调用细节」。旧值 `normal` 和 `expanded` 均读取为 `detailed`,不自动回写;已有 `detailed` 保持不变。未配置、无效值以及 Host 设置到达前均使用 `standard`;其他设置的无效值仍会校验失败。
| 行为 | 简洁 | 标准 | 详细 | 完全展开 |
|---|---|---|---|---|
@@ -39,8 +39,8 @@ export class TranscriptViewPolicy {
const section = this.host.getSnapshot().value
if (section === undefined) return
const saved = section.transcriptView
const mode = saved === LEGACY_TRANSCRIPT_VIEW_MODE ? 'standard'
: saved === LEGACY_EXPANDED_TRANSCRIPT_VIEW_MODE ? 'detailed' : saved
const mode = saved === LEGACY_TRANSCRIPT_VIEW_MODE || saved === LEGACY_EXPANDED_TRANSCRIPT_VIEW_MODE
? 'detailed' : saved
if (this.mode.getSnapshot() !== mode) this.mode.set(mode)
}
}
@@ -26,22 +26,27 @@ describe('TranscriptViewPolicy', () => {
expect(host.set).toHaveBeenCalledWith('transcriptView', 'detailed')
})
it('adopts Host state, reads normal as Standard, and ignores identical writes', () => {
it.each(['normal', 'expanded'] as const)('reads a later Host %s setting as Detailed without writing it back', (mode) => {
const host = stubConfigForm<ChatSettings>()
const policy = new TranscriptViewPolicy(host.scope)
host.publish({ status: 'ready', value: { linkOpening: 'sidebar', transcriptView: 'normal', performanceUsage: 'detailed' }, revision: 1, writable: true })
expect(policy.mode.getSnapshot()).toBe('standard')
policy.setMode('standard')
host.publish({ status: 'ready', value: { linkOpening: 'sidebar', transcriptView: mode, performanceUsage: 'detailed' }, revision: 1, writable: true })
expect(policy.mode.getSnapshot()).toBe('detailed')
expect(host.set).not.toHaveBeenCalled()
policy.setMode('detailed')
expect(host.set).not.toHaveBeenCalled()
policy.setMode('standard')
expect(policy.mode.getSnapshot()).toBe('standard')
expect(host.set).toHaveBeenCalledExactlyOnceWith('transcriptView', 'standard')
host.publish({ value: { linkOpening: 'sidebar', transcriptView: 'compact', performanceUsage: 'detailed' }, revision: 2 })
expect(policy.mode.getSnapshot()).toBe('compact')
})
it('adopts an accepted section standing at construction', () => {
it.each(['normal', 'expanded'] as const)('reads an initial Host %s setting as Detailed without writing it back', (mode) => {
const host = stubConfigForm<ChatSettings>()
host.publish({ status: 'ready', value: { linkOpening: 'sidebar', transcriptView: 'expanded', performanceUsage: 'detailed' }, revision: 1, writable: true })
host.publish({ status: 'ready', value: { linkOpening: 'sidebar', transcriptView: mode, performanceUsage: 'detailed' }, revision: 1, writable: true })
expect(new TranscriptViewPolicy(host.scope).mode.getSnapshot()).toBe('detailed')
expect(host.set).not.toHaveBeenCalled()
})