mirror of
https://github.com/langgenius/dify.git
synced 2026-05-03 17:08:03 +08:00
refactor(web): make Switch controlled-only and migrate call sites (#32399)
This commit is contained in:
@ -17,7 +17,7 @@ const RequiredSwitch: FC<RequiredSwitchProps> = ({
|
||||
return (
|
||||
<div className="flex items-center gap-x-1 rounded-[5px] border border-divider-subtle bg-background-default-lighter px-1.5 py-1">
|
||||
<span className="system-2xs-medium-uppercase text-text-secondary">{t('nodes.llm.jsonSchema.required', { ns: 'workflow' })}</span>
|
||||
<Switch size="xs" defaultValue={defaultValue} onChange={toggleRequired} />
|
||||
<Switch size="xs" value={defaultValue} onChange={toggleRequired} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@ const ReasoningFormatConfig: FC<ReasoningFormatConfigProps> = ({
|
||||
operations={(
|
||||
// ON = separated, OFF = tagged
|
||||
<Switch
|
||||
defaultValue={value === 'separated'}
|
||||
value={value === 'separated'}
|
||||
onChange={enabled => onChange(enabled ? 'separated' : 'tagged')}
|
||||
size="md"
|
||||
disabled={readonly}
|
||||
|
||||
@ -285,7 +285,7 @@ const Panel: FC<NodePanelProps<LLMNodeType>> = ({
|
||||
</Tooltip>
|
||||
<Switch
|
||||
className="ml-2"
|
||||
defaultValue={!!inputs.structured_output_enabled}
|
||||
value={!!inputs.structured_output_enabled}
|
||||
onChange={handleStructureOutputEnableChange}
|
||||
size="md"
|
||||
disabled={readOnly}
|
||||
|
||||
Reference in New Issue
Block a user