diff --git a/web/src/app/home/plugins/page.tsx b/web/src/app/home/plugins/page.tsx index 389a9a75..6dc59ee7 100644 --- a/web/src/app/home/plugins/page.tsx +++ b/web/src/app/home/plugins/page.tsx @@ -95,16 +95,20 @@ export default function PluginConfigPage() { }; const getFormSchema = (t: (key: string) => string) => z.object({ - name: z.string({ required_error: t('mcp.nameRequired') }), + name: z + .string({ required_error: t('mcp.nameRequired') }) + .min(1, { message: t('mcp.nameRequired') }), timeout: z .number({ invalid_type_error: t('mcp.timeoutMustBeNumber') }) - .nonnegative({ message: t('mcp.timeoutNonNegative') }) + .positive({ message: t('mcp.timeoutMustBePositive') }) .default(30), ssereadtimeout: z .number({ invalid_type_error: t('mcp.sseTimeoutMustBeNumber') }) - .nonnegative({ message: t('mcp.sseTimeoutNonNegative') }) + .positive({ message: t('mcp.timeoutMustBePositive') }) .default(300), - url: z.string({ required_error: t('models.requestURLRequired') }), + url: z + .string({ required_error: t('mcp.urlRequired') }) + .min(1, { message: t('mcp.urlRequired') }), extra_args: z .array( z.object({ @@ -1207,7 +1211,14 @@ export default function PluginConfigPage() { {t('mcp.timeout')} - + + field.onChange(Number(e.target.value)) + } + /> diff --git a/web/src/i18n/locales/en-US.ts b/web/src/i18n/locales/en-US.ts index e24c44aa..44c0ce95 100644 --- a/web/src/i18n/locales/en-US.ts +++ b/web/src/i18n/locales/en-US.ts @@ -284,7 +284,6 @@ const enUS = { }, mcp: { title: 'MCP Management', - description: 'Manage Model Context Protocol (MCP) servers to extend AI capabilities', createServer: 'Create MCP Server', editServer: 'Edit MCP Server', deleteServer: 'Delete MCP Server', @@ -295,11 +294,11 @@ const enUS = { serverMode: 'Connection Mode', stdio: 'Stdio Mode', sse: 'SSE Mode', - serverConfig: 'MCP Server Configuration', noServerInstalled: 'No MCP servers configured', serverNameRequired: 'Server name cannot be empty', commandRequired: 'Command cannot be empty', urlRequired: 'URL cannot be empty', + timeoutMustBePositive: 'Timeout must be a positive number', command: 'Command', args: 'Arguments', env: 'Environment Variables', @@ -311,13 +310,10 @@ const enUS = { addHeader: 'Add Header', keyName: 'Key Name', value: 'Value', - connected: 'Connected', - disconnected: 'Disconnected', - error: 'Error', - testConnection: 'Test Connection', testing: 'Testing...', testSuccess: 'Connection test successful', testFailed: 'Connection test failed: ', + testError: 'Connection test error', connectionSuccess: 'Connection successful', connectionFailed: 'Connection failed', toolsFound: 'tools', @@ -328,51 +324,36 @@ const enUS = { getTaskFailed: 'Failed to get task status', noTaskId: 'No task ID obtained', deleteSuccess: 'Deleted successfully', + deleteFailed: 'Delete failed: ', deleteError: 'Delete failed: ', saveSuccess: 'Saved successfully', saveError: 'Save failed: ', createSuccess: 'Created successfully', + createFailed: 'Creation failed: ', createError: 'Creation failed: ', + loadFailed: 'Load failed', modifyFailed: 'Modify failed: ', toolCount: 'Tools: {{count}}', statusConnected: 'Connected', statusDisconnected: 'Disconnected', statusError: 'Connection Error', statusDisabled: 'Disabled', - serverStatus: 'Server Status', - marketplace: 'MCP Marketplace', - searchServer: 'Search MCP servers', - sortBy: 'Sort by', - mostStars: 'Most stars', - recentlyAdded: 'Recently added', - recentlyUpdated: 'Recently updated', loading: 'Loading...', - noMatchingServers: 'No matching MCP servers', starCount: 'Stars: {{count}}', install: 'Install', - installing: 'Installing...', - installSuccess: 'MCP server installed successfully', - installFailed: 'MCP server installation failed', installFromGithub: 'Install MCP Server from GitHub', - onlySupportGithub: 'Currently only supports installation from GitHub', - enterGithubLink: 'Enter GitHub repository link', add: 'Add', name: 'Name', - nameExplained: 'Used to distinguish different MCP server instances', - sseURL: 'SSE URL', - sseHeaders: 'SSE Headers', nameRequired: 'Name cannot be empty', - sseURLRequired: 'SSE URL cannot be empty', - enterSSELink: 'Enter SSE URL', - timeoutRequired: 'Timeout cannot be empty', - headersExample: 'Example: Authorization: Bearer token123', - enterTimeout: 'Enter timeout in milliseconds', - installFromSSE: 'Install from SSE', sseTimeout: 'SSE Timeout', sseTimeoutDescription: 'Timeout for establishing SSE connection', extraParametersDescription: 'Additional parameters for configuring specific MCP server behavior', + timeoutMustBeNumber: 'Timeout must be a number', + timeoutNonNegative: 'Timeout cannot be negative', + sseTimeoutMustBeNumber: 'SSE timeout must be a number', + sseTimeoutNonNegative: 'SSE timeout cannot be negative', updateSuccess: 'Updated successfully', - testError: 'Connection test error', + updateFailed: 'Update failed: ', }, pipelines: { title: 'Pipelines', diff --git a/web/src/i18n/locales/ja-JP.ts b/web/src/i18n/locales/ja-JP.ts index 01b4c919..1907689e 100644 --- a/web/src/i18n/locales/ja-JP.ts +++ b/web/src/i18n/locales/ja-JP.ts @@ -286,7 +286,6 @@ const jaJP = { }, mcp: { title: 'MCP管理', - description: 'Model Context Protocol (MCP) サーバーを管理してAI機能を拡張', createServer: 'MCPサーバーを作成', editServer: 'MCPサーバーを編集', deleteServer: 'MCPサーバーを削除', @@ -297,11 +296,11 @@ const jaJP = { serverMode: '接続モード', stdio: 'Stdioモード', sse: 'SSEモード', - serverConfig: 'MCPサーバー設定', noServerInstalled: 'MCPサーバーが設定されていません', serverNameRequired: 'サーバー名は必須です', commandRequired: 'コマンドは必須です', urlRequired: 'URLは必須です', + timeoutMustBePositive: 'タイムアウトは正の数でなければなりません', command: 'コマンド', args: '引数', env: '環境変数', @@ -313,13 +312,10 @@ const jaJP = { addHeader: 'ヘッダーを追加', keyName: 'キー名', value: '値', - connected: '接続済み', - disconnected: '未接続', - error: 'エラー', - testConnection: '接続テスト', testing: 'テスト中...', testSuccess: '接続テストに成功しました', testFailed: '接続テストに失敗しました:', + testError: '接続テストエラー', connectionSuccess: '接続に成功しました', connectionFailed: '接続に失敗しました', toolsFound: '個のツール', @@ -330,51 +326,36 @@ const jaJP = { getTaskFailed: 'タスクステータスの取得に失敗しました', noTaskId: 'タスクIDを取得できませんでした', deleteSuccess: '削除に成功しました', + deleteFailed: '削除に失敗しました:', deleteError: '削除に失敗しました:', saveSuccess: '保存に成功しました', saveError: '保存に失敗しました:', createSuccess: '作成に成功しました', + createFailed: '作成に失敗しました:', createError: '作成に失敗しました:', + loadFailed: '読み込みに失敗しました', modifyFailed: '変更に失敗しました:', toolCount: 'ツール:{{count}}', statusConnected: '接続済み', statusDisconnected: '未接続', statusError: '接続エラー', statusDisabled: '無効', - serverStatus: 'サーバーステータス', - marketplace: 'MCPマーケットプレイス', - searchServer: 'MCPサーバーを検索', - sortBy: '並び順', - mostStars: 'スター数順', - recentlyAdded: '最近追加', - recentlyUpdated: '最近更新', loading: '読み込み中...', - noMatchingServers: '一致するMCPサーバーが見つかりません', starCount: 'スター:{{count}}', install: 'インストール', - installing: 'インストール中...', - installSuccess: 'MCPサーバーのインストールに成功しました', - installFailed: 'MCPサーバーのインストールに失敗しました', installFromGithub: 'GitHubからMCPサーバーをインストール', - onlySupportGithub: '現在はGitHubからのインストールのみサポートしています', - enterGithubLink: 'GitHubリポジトリのリンクを入力', add: '追加', name: '名前', - nameExplained: '異なるMCPサーバーインスタンスを区別するために使用', - sseURL: 'SSE URL', - sseHeaders: 'SSEヘッダー', nameRequired: '名前は必須です', - sseURLRequired: 'SSE URLは必須です', - enterSSELink: 'SSE URLを入力', - timeoutRequired: 'タイムアウトは必須です', - headersExample: '例: Authorization: Bearer token123', - enterTimeout: 'タイムアウトをミリ秒単位で入力', - installFromSSE: 'SSEからインストール', sseTimeout: 'SSEタイムアウト', sseTimeoutDescription: 'SSE接続を確立するためのタイムアウト', extraParametersDescription: 'MCPサーバーの特定の動作を設定するための追加パラメータ', + timeoutMustBeNumber: 'タイムアウトは数値である必要があります', + timeoutNonNegative: 'タイムアウトは負の数にできません', + sseTimeoutMustBeNumber: 'SSEタイムアウトは数値である必要があります', + sseTimeoutNonNegative: 'SSEタイムアウトは負の数にできません', updateSuccess: '更新に成功しました', - testError: '接続テスト出錯', + updateFailed: '更新に失敗しました:', }, pipelines: { title: 'パイプライン', diff --git a/web/src/i18n/locales/zh-Hans.ts b/web/src/i18n/locales/zh-Hans.ts index 8fd3f57b..8cbac761 100644 --- a/web/src/i18n/locales/zh-Hans.ts +++ b/web/src/i18n/locales/zh-Hans.ts @@ -272,7 +272,6 @@ const zhHans = { }, mcp: { title: 'MCP管理', - description: '管理Model Context Protocol (MCP) 服务器,扩展AI能力', createServer: '创建MCP服务器', editServer: '编辑MCP服务器', deleteServer: '删除MCP服务器', @@ -283,11 +282,11 @@ const zhHans = { serverMode: '连接模式', stdio: 'Stdio模式', sse: 'SSE模式', - serverConfig: 'MCP服务器配置', noServerInstalled: '暂未配置任何MCP服务器', serverNameRequired: '服务器名称不能为空', commandRequired: '命令不能为空', urlRequired: 'URL不能为空', + timeoutMustBePositive: '超时时间必须是正数', command: '命令', args: '参数', env: '环境变量', @@ -299,10 +298,6 @@ const zhHans = { addHeader: '添加请求头', keyName: '键名', value: '值', - connected: '已打开', - disconnected: '未打开', - error: '错误', - testConnection: '测试连接', testing: '测试中...', testSuccess: '连接测试成功', testFailed: '连接测试失败:', @@ -317,50 +312,36 @@ const zhHans = { getTaskFailed: '获取任务状态失败', noTaskId: '未获取到任务ID', deleteSuccess: '删除成功', + deleteFailed: '删除失败:', deleteError: '删除失败:', saveSuccess: '保存成功', saveError: '保存失败:', createSuccess: '创建成功', + createFailed: '创建失败:', createError: '创建失败:', + loadFailed: '加载失败', modifyFailed: '修改失败:', toolCount: '工具:{{count}}', statusConnected: '已打开', statusDisconnected: '未打开', statusError: '连接错误', statusDisabled: '已禁用', - serverStatus: '服务器状态', - marketplace: 'MCP商店', - searchServer: '搜索MCP服务器', - sortBy: '排序方式', - mostStars: '最多星标', - recentlyAdded: '最近添加', - recentlyUpdated: '最近更新', loading: '加载中...', - noMatchingServers: '没有匹配的MCP服务器', starCount: '星标:{{count}}', install: '安装', - installing: '安装中...', - installSuccess: 'MCP服务器安装成功', - installFailed: 'MCP服务器安装失败', installFromGithub: '从Github安装MCP服务器', - onlySupportGithub: '目前仅支持从Github安装MCP服务器', - enterGithubLink: '输入Github仓库链接', add: '添加', name: '名称', - nameExplained: '用于区分不同的MCP服务器实例', - sseURL: 'SSE URL', - sseHeaders: 'SSE Headers', nameRequired: '名称不能为空', - sseURLRequired: 'SSE URL不能为空', - enterSSELink: '输入SSE URL', - timeoutRequired: '超时时间不能为空', - headersExample: '示例: Authorization: Bearer token123', - enterTimeout: '输入超时时间,单位为毫秒', - installFromSSE: '从SSE安装', sseTimeout: 'SSE超时时间', sseTimeoutDescription: '用于建立SSE连接的超时时间', extraParametersDescription: '额外参数,用于配置MCP服务器的特定行为', + timeoutMustBeNumber: '超时时间必须是数字', + timeoutNonNegative: '超时时间不能为负数', + sseTimeoutMustBeNumber: 'SSE超时时间必须是数字', + sseTimeoutNonNegative: 'SSE超时时间不能为负数', updateSuccess: '更新成功', + updateFailed: '更新失败:', }, pipelines: { title: '流水线', diff --git a/web/src/i18n/locales/zh-Hant.ts b/web/src/i18n/locales/zh-Hant.ts index 88905a72..6c654b91 100644 --- a/web/src/i18n/locales/zh-Hant.ts +++ b/web/src/i18n/locales/zh-Hant.ts @@ -270,7 +270,6 @@ const zhHant = { }, mcp: { title: 'MCP管理', - description: '管理Model Context Protocol (MCP) 伺服器,擴展AI能力', createServer: '建立MCP伺服器', editServer: '編輯MCP伺服器', deleteServer: '刪除MCP伺服器', @@ -281,11 +280,11 @@ const zhHant = { serverMode: '連接模式', stdio: 'Stdio模式', sse: 'SSE模式', - serverConfig: 'MCP伺服器設定', noServerInstalled: '暫未設定任何MCP伺服器', serverNameRequired: '伺服器名稱不能為空', commandRequired: '命令不能為空', urlRequired: 'URL不能為空', + timeoutMustBePositive: '逾時時間必須是正數', command: '命令', args: '參數', env: '環境變數', @@ -297,13 +296,10 @@ const zhHant = { addHeader: '新增請求標頭', keyName: '鍵名', value: '值', - connected: '已開啟', - disconnected: '未開啟', - error: '錯誤', - testConnection: '測試連接', testing: '測試中...', testSuccess: '連接測試成功', testFailed: '連接測試失敗:', + testError: '連接測試出錯', connectionSuccess: '連接成功', connectionFailed: '連接失敗', toolsFound: '個工具', @@ -314,51 +310,36 @@ const zhHant = { getTaskFailed: '獲取任務狀態失敗', noTaskId: '未獲取到任務ID', deleteSuccess: '刪除成功', + deleteFailed: '刪除失敗:', deleteError: '刪除失敗:', saveSuccess: '儲存成功', saveError: '儲存失敗:', createSuccess: '建立成功', + createFailed: '建立失敗:', createError: '建立失敗:', + loadFailed: '載入失敗', modifyFailed: '修改失敗:', toolCount: '工具:{{count}}', statusConnected: '已開啟', statusDisconnected: '未開啟', statusError: '連接錯誤', statusDisabled: '已停用', - serverStatus: '伺服器狀態', - marketplace: 'MCP商店', - searchServer: '搜尋MCP伺服器', - sortBy: '排序方式', - mostStars: '最多星標', - recentlyAdded: '最近新增', - recentlyUpdated: '最近更新', loading: '載入中...', - noMatchingServers: '沒有找到符合的MCP伺服器', starCount: '星標:{{count}}', install: '安裝', - installing: '安裝中...', - installSuccess: 'MCP伺服器安裝成功', - installFailed: 'MCP伺服器安裝失敗', installFromGithub: '從Github安裝MCP伺服器', - onlySupportGithub: '目前僅支援從Github安裝MCP伺服器', - enterGithubLink: '輸入Github儲存庫連結', add: '新增', name: '名稱', - nameExplained: '用於區分不同的MCP伺服器實例', - sseURL: 'SSE URL', - sseHeaders: 'SSE Headers', nameRequired: '名稱不能為空', - sseURLRequired: 'SSE URL不能為空', - enterSSELink: '輸入SSE URL', - timeoutRequired: '逾時時間不能為空', - headersExample: '範例: Authorization: Bearer token123', - enterTimeout: '輸入逾時時間,單位為毫秒', - installFromSSE: '從SSE安裝', sseTimeout: 'SSE逾時時間', sseTimeoutDescription: '用於建立SSE連接的逾時時間', extraParametersDescription: '額外參數,用於設定MCP伺服器的特定行為', + timeoutMustBeNumber: '逾時時間必須是數字', + timeoutNonNegative: '逾時時間不能為負數', + sseTimeoutMustBeNumber: 'SSE逾時時間必須是數字', + sseTimeoutNonNegative: 'SSE逾時時間不能為負數', updateSuccess: '更新成功', - testError: '連接測試出錯' + updateFailed: '更新失敗:', }, pipelines: { title: '流程線',