docs/architecture/test-area-version-model-selection.md
In the current /basic/user workspace, the right-side test area implicitly tests:
session.prompt (v0)session.optimizedPrompt (whatever is currently in the optimized editor)session.selectedTestModelKey (single shared model)This creates hard coupling between test inputs and the editor textareas. Users want to compare arbitrary versions (v0..vn) and also compare the same version under different models.
Phase 1 (this doc): implement only for /basic/user.
Out of scope for phase 1:
/basic/system, /pro/*, /image/* rolloutFunctional:
latestNon-functional:
packages/ui/src/components/basic-mode/BasicUserWorkspace.vuepackages/ui/src/composables/workspaces/useBasicWorkspaceLogic.ts#handleTestpackages/ui/src/stores/session/useBasicUserSession.tspackages/ui/src/components/TestAreaPanel.vuepackages/ui/src/components/TestResultSection.vuepackages/ui/src/components/TestControlBar.vuepackages/core/src/services/history/types.tsUse a JSON-serializable union value:
// 0 represents v0.
// number >= 1 represents v1..vn.
// 'latest' follows the max version in the chain.
export type TestPanelVersionValue = 0 | number | 'latest'
export interface TestPanelConfig {
version: TestPanelVersionValue
modelKey: string
}
export interface BasicUserTestPanelsConfig {
original: TestPanelConfig
optimized: TestPanelConfig
}
Add to BasicUserSessionState:
testPanels?: BasicUserTestPanelsConfig
Add update helpers (exact names can vary):
updateTestPanelVersion(panel: 'original'|'optimized', v: TestPanelVersionValue)updateTestPanelModel(panel: 'original'|'optimized', modelKey: string)Persist these inside the existing preference key session/v1/basic-user.
When restoring session state:
testPanels is missing (legacy session):
original.version = 0optimized.version = 'latest'original.modelKey = parsed.selectedTestModelKey || fallbackModelKeyoptimized.modelKey = parsed.selectedTestModelKey || fallbackModelKeyIf any selected model key is not in enabled models, apply the existing fallback strategy (first enabled model).
At test time (not at render time), resolve selection into actual prompt text.
Inputs:
v0Prompt: string (from session.prompt)chainVersions: PromptRecord[] (from logic.currentVersions)selected: TestPanelVersionValueAlgorithm:
selected === 0: return v0Prompt.latestRecord = max(chainVersions, by record.version).selected === 'latest':
latestRecord.optimizedPrompt if presentv0Promptselected is a number >= 1:
record.version === selectedoptimizedPromptNote: history chain versions start at 1, so v0 is always external.
To avoid ambiguity, place selectors in each result card header:
The main TestControlBar retains:
TestResultSection.vue:
original-header-extraoptimized-header-extrasingle-header-extra (optional)Render them next to the title (and before/after evaluation entry).
TestAreaPanel.vue:
TestAreaPanel to TestResultSection.BasicUserWorkspace.vue:
v0latest if chain exists (still allowed if empty; it falls back)v1..vn derived from logic.currentVersionsv-model of each select to session store testPanels state.Keep existing i18n titles but append selection info for clarity, e.g.
原始提示词结果 (v0)优化后提示词结果 (latest=v6)This can be implemented by computing originalResultTitle and optimizedResultTitle from the selected values.
Update the test handler for /basic/user so that it no longer depends on editor textareas.
Compare mode ON:
testPanels.original.modelKeytestPanels.optimized.modelKeytestResults shape:
originalResult/originalReasoningoptimizedResult/optimizedReasoningCompare mode OFF:
Current evaluation logic assumes:
After this change, the evaluation handler in BasicUserWorkspace.vue must be bound to:
originalPrompt = resolvedPrompt(original panel)optimizedPrompt = resolvedPrompt(optimized panel)So that "compare evaluation" reflects the actual selected versions.
latest resolves to v0.useBasicUserSession with testPanels persisted state and migration defaults.TestResultSection and pass-through in TestAreaPanel.BasicUserWorkspace and bind to session store.