fix(agent-v2): show build draft env changes

This commit is contained in:
yyh
2026-07-01 18:57:55 +08:00
parent 6ce486a449
commit c8e6ff3ebf
3 changed files with 17 additions and 2 deletions

View File

@ -17,6 +17,7 @@ export function AgentAdvancedSettings() {
panelId={advancedSettingsPanelId}
description={t('agentDetail.configure.advancedSettings.description')}
defaultOpen={false}
buildDraftChangeSection="advancedSettings"
rootClassName="gap-2 pt-1 pb-3"
headerClassName="mb-0 pt-2"
titleRowClassName="min-h-6"

View File

@ -9,10 +9,12 @@ export type AgentBuildDraftChangedKey = keyof AgentSoulConfigFormState
export type AgentBuildDraftChangeSection
= | 'skills'
| 'files'
| 'advancedSettings'
const changedKeysBySection: Record<AgentBuildDraftChangeSection, readonly AgentBuildDraftChangedKey[]> = {
skills: ['skills'],
files: ['files'],
advancedSettings: ['envVariables'],
}
const AgentBuildDraftChangedKeysContext = createContext<ReadonlySet<AgentBuildDraftChangedKey>>(new Set())

View File

@ -7,13 +7,19 @@ function renderSection({
section = 'skills',
changedKeys,
}: {
section?: 'skills' | 'files'
section?: 'skills' | 'files' | 'advancedSettings'
changedKeys: AgentBuildDraftChangedKey[]
}) {
const label = {
advancedSettings: 'Advanced Settings',
files: 'Files',
skills: 'Skills',
}[section]
return render(
<AgentBuildDraftChangedKeysProvider changedKeys={changedKeys}>
<ConfigureSection
label={section === 'skills' ? 'Skills' : 'Files'}
label={label}
labelId={`${section}-label`}
buildDraftChangeSection={section}
>
@ -36,6 +42,12 @@ describe('ConfigureSection', () => {
expect(screen.getByRole('heading', { name: 'Files' }).querySelector('.bg-text-warning-secondary')).toBeInTheDocument()
})
it('should show a build draft change dot when Advanced Settings changed', () => {
renderSection({ section: 'advancedSettings', changedKeys: ['envVariables'] })
expect(screen.getByRole('heading', { name: 'Advanced Settings' }).querySelector('.bg-text-warning-secondary')).toBeInTheDocument()
})
it('should not show a build draft change dot when only another key changed', () => {
renderSection({ section: 'skills', changedKeys: ['prompt'] })