import type { FC } from 'react' import { useTranslation } from 'react-i18next' import Switch from '@/app/components/base/switch' import type { ModerationContentConfig } from '@/models/debug' type ModerationContentProps = { title: string info?: string showPreset?: boolean config: ModerationContentConfig onConfigChange: (config: ModerationContentConfig) => void } const ModerationContent: FC = ({ title, info, showPreset = true, config, onConfigChange, }) => { const { t } = useTranslation() const handleConfigChange = (field: string, value: boolean | string) => { if (field === 'preset_response' && typeof value === 'string') value = value.slice(0, 100) onConfigChange({ ...config, [field]: value }) } return (
{title}
{ info && (
{info}
) } handleConfigChange('enabled', v)} />
{ config.enabled && showPreset && (
{t('appDebug.feature.moderation.modal.content.preset')} {t('appDebug.feature.moderation.modal.content.supportMarkdown')}