wwf
3 天以前 a430284aa21e3ae1f0d5654e55b2ad2852519cc2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import React from 'react'
import type { FC } from 'react'
import Switch from '@/app/components/base/switch'
import { useTranslation } from 'react-i18next'
 
type RequiredSwitchProps = {
  defaultValue: boolean
  toggleRequired: () => void
}
 
const RequiredSwitch: FC<RequiredSwitchProps> = ({
  defaultValue,
  toggleRequired,
}) => {
  const { t } = useTranslation()
 
  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('workflow.nodes.llm.jsonSchema.required')}</span>
      <Switch size='xs' defaultValue={defaultValue} onChange={toggleRequired} />
    </div>
  )
}
 
export default React.memo(RequiredSwitch)