diff --git a/web/src/i18n/en.ts b/web/src/i18n/en.ts index b9ab09b0..b0f70d4d 100644 --- a/web/src/i18n/en.ts +++ b/web/src/i18n/en.ts @@ -1948,7 +1948,9 @@ Memory Bear: After the rebellion, regional warlordism intensified for several re path: 'Path', viewDetail: 'View Details', textLink: 'Test Connection', - noResult: 'Processing results will be displayed here' + noResult: 'Processing results will be displayed here', + serverUrlInvalid: 'Must start with http:// or https://, and cannot have leading or trailing spaces', + requestHeaderKeyInvalid: 'Only English letters, numbers, hyphens (-), and underscores (_) are allowed, and cannot start or end with a hyphen or underscore', }, workflow: { coreNode: 'Core Nodes', diff --git a/web/src/i18n/zh.ts b/web/src/i18n/zh.ts index 71a20207..f04ef4b1 100644 --- a/web/src/i18n/zh.ts +++ b/web/src/i18n/zh.ts @@ -1945,7 +1945,9 @@ export const zh = { path: '路径', viewDetail: '查看详情', textLink: '测试连接', - noResult: '处理结果将显示在这里' + noResult: '处理结果将显示在这里', + serverUrlInvalid: '必须以 http:// 或 https:// 开头,且不能有前后空格', + requestHeaderKeyInvalid: '只支持英文、数字、连字符(-)、下划线(_),不能以连字符或下划线开头结尾', }, workflow: { coreNode: '核心节点', diff --git a/web/src/views/ToolManagement/components/CustomToolModal.tsx b/web/src/views/ToolManagement/components/CustomToolModal.tsx index e3203a74..0ea8aca9 100644 --- a/web/src/views/ToolManagement/components/CustomToolModal.tsx +++ b/web/src/views/ToolManagement/components/CustomToolModal.tsx @@ -6,6 +6,7 @@ import type { CustomToolItem, CustomToolModalRef, ToolItem } from '../types' import RbModal from '@/components/RbModal'; import { parseSchema, addTool, updateTool } from '@/api/tools'; import Table from '@/components/Table'; +import { stringRegExp } from '@/utils/validator'; const FormItem = Form.Item; interface CustomToolModalProps { @@ -134,7 +135,11 @@ const CustomToolModal = forwardRef(({ diff --git a/web/src/views/ToolManagement/components/McpServiceModal.tsx b/web/src/views/ToolManagement/components/McpServiceModal.tsx index a104c2d6..bd97b876 100644 --- a/web/src/views/ToolManagement/components/McpServiceModal.tsx +++ b/web/src/views/ToolManagement/components/McpServiceModal.tsx @@ -9,6 +9,7 @@ import RequestHeaderModal from './RequestHeaderModal'; import Table from '@/components/Table'; import { addTool, updateTool, testConnection } from '@/api/tools' import type { McpServiceModalRef } from '../types' +import { stringRegExp } from '@/utils/validator'; const FormItem = Form.Item; @@ -168,14 +169,22 @@ const McpServiceModal = forwardRef(({ name={['config', "server_url"]} label={t('tool.serviceEndpoint')} extra={t('tool.serviceEndpointExtra')} - rules={[{ required: true, message: t('common.pleaseEnter') }]} + rules={[ + { required: true, message: t('common.pleaseEnter') }, + { max: 500 }, + { pattern: /^https?:\/\/\S+$/, message: t('tool.serverUrlInvalid') }, + ]} > @@ -201,6 +210,7 @@ const McpServiceModal = forwardRef(({ diff --git a/web/src/views/ToolManagement/components/RequestHeaderModal.tsx b/web/src/views/ToolManagement/components/RequestHeaderModal.tsx index 5e20120d..1f2bdff3 100644 --- a/web/src/views/ToolManagement/components/RequestHeaderModal.tsx +++ b/web/src/views/ToolManagement/components/RequestHeaderModal.tsx @@ -4,6 +4,7 @@ import { useTranslation } from 'react-i18next'; import type { RequestHeader, RequestHeaderModalRef } from './McpServiceModal' import RbModal from '@/components/RbModal' +import { stringRegExp } from '@/utils/validator'; const FormItem = Form.Item; @@ -82,7 +83,11 @@ const RequestHeaderModal = forwardRef @@ -90,7 +95,11 @@ const RequestHeaderModal = forwardRef