mirror of
https://github.com/langgenius/dify.git
synced 2026-04-24 21:05:48 +08:00
fix(sandbox): use deleteConfig when switching to managed mode
Delete user config instead of saving empty config when switching to managed mode, allowing the system to fall back to system defaults.
This commit is contained in:
@ -102,13 +102,10 @@ function ConfigModal({ provider, onClose }: ConfigModalProps) {
|
||||
}, [provider.config_schema, provider.config, t])
|
||||
|
||||
const handleSave = useCallback(async () => {
|
||||
// For managed mode, save empty config to use system defaults
|
||||
// For managed mode, delete user config to use system defaults
|
||||
if (shouldShowModeSelection && configMode === 'managed') {
|
||||
try {
|
||||
await saveConfig({
|
||||
providerType: provider.provider_type,
|
||||
config: {},
|
||||
})
|
||||
await deleteConfig(provider.provider_type)
|
||||
notify({ type: 'success', message: t('api.saved', { ns: 'common' }) })
|
||||
onClose()
|
||||
}
|
||||
@ -137,7 +134,7 @@ function ConfigModal({ provider, onClose }: ConfigModalProps) {
|
||||
catch {
|
||||
// Error toast is handled by fetch layer
|
||||
}
|
||||
}, [shouldShowModeSelection, configMode, saveConfig, provider.provider_type, notify, t, onClose])
|
||||
}, [shouldShowModeSelection, configMode, saveConfig, deleteConfig, provider.provider_type, notify, t, onClose])
|
||||
|
||||
const handleRevoke = useCallback(async () => {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user