feat: Add automatic channel disabling based on configurable keywords

- Introduce AutomaticDisableKeywords setting to dynamically control channel disabling
- Implement AC search for matching error messages against disable keywords
- Add frontend UI for configuring automatic disable keywords
- Update localization with new keyword-based channel disabling feature
- Refactor sensitive word and AC search logic to support multiple keyword lists
This commit is contained in:
1808837298@qq.com
2025-02-13 16:39:17 +08:00
parent bc62d1bb81
commit 9edb9f7a71
10 changed files with 97 additions and 50 deletions

View File

@@ -5,7 +5,7 @@ import {
API,
showError,
showSuccess,
showWarning,
showWarning, verifyJSON
} from '../../../helpers';
import { useTranslation } from 'react-i18next';
@@ -17,6 +17,7 @@ export default function SettingsMonitoring(props) {
QuotaRemindThreshold: '',
AutomaticDisableChannelEnabled: false,
AutomaticEnableChannelEnabled: false,
AutomaticDisableKeywords: '',
});
const refForm = useRef();
const [inputsRow, setInputsRow] = useState(inputs);
@@ -79,7 +80,7 @@ export default function SettingsMonitoring(props) {
<Row gutter={16}>
<Col span={8}>
<Form.InputNumber
label={t('最长响应时间')}
label={t('测试所有渠道的最长响应时间')}
step={1}
min={0}
suffix={t('秒')}
@@ -144,6 +145,18 @@ export default function SettingsMonitoring(props) {
/>
</Col>
</Row>
<Row gutter={16}>
<Col span={16}>
<Form.TextArea
label={t('自动禁用关键词')}
placeholder={t('一行一个,不区分大小写')}
extraText={t('当上游通道返回错误中包含这些关键词时(不区分大小写),自动禁用通道')}
field={'AutomaticDisableKeywords'}
autosize={{ minRows: 6, maxRows: 12 }}
onChange={(value) => setInputs({ ...inputs, AutomaticDisableKeywords: value })}
/>
</Col>
</Row>
<Row>
<Button size='default' onClick={onSubmit}>
{t('保存监控设置')}