mirror of
https://github.com/langgenius/dify.git
synced 2026-07-15 01:17:04 +08:00
fix(agent-v2): show build draft env changes
This commit is contained in:
@ -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"
|
||||
|
||||
@ -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())
|
||||
|
||||
@ -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'] })
|
||||
|
||||
|
||||
Reference in New Issue
Block a user