From a36ba95c1c2fd96d4d897b0e6b04669ac51ee3a7 Mon Sep 17 00:00:00 2001 From: chanx <1243304602@qq.com> Date: Tue, 5 Aug 2025 09:26:59 +0800 Subject: [PATCH] Fix: Add prompt text to the form in the MCP module (#9222) ### What problem does this PR solve? Fix: Add prompt text to the form in the MCP module #3221 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- web/src/locales/en.ts | 7 +++++++ .../pages/profile-setting/mcp/edit-mcp-form.tsx | 15 +++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/web/src/locales/en.ts b/web/src/locales/en.ts index 7a5ce123a..734024b78 100644 --- a/web/src/locales/en.ts +++ b/web/src/locales/en.ts @@ -39,6 +39,13 @@ export default { nextPage: 'Next', add: 'Add', promptPlaceholder: `Please input or use / to quickly insert variables.`, + mcp: { + namePlaceholder: 'My MCP Server', + nameRequired: + 'It must be 1–64 characters long and can only contain letters, numbers, hyphens, and underscores.', + urlPlaceholder: 'https://api.example.com/v1/mcp', + tokenPlaceholder: 'e.g. eyJhbGciOiJIUzI1Ni...', + }, }, login: { login: 'Sign in', diff --git a/web/src/pages/profile-setting/mcp/edit-mcp-form.tsx b/web/src/pages/profile-setting/mcp/edit-mcp-form.tsx index dfad0ff38..3af21786b 100644 --- a/web/src/pages/profile-setting/mcp/edit-mcp-form.tsx +++ b/web/src/pages/profile-setting/mcp/edit-mcp-form.tsx @@ -37,20 +37,23 @@ export function useBuildFormSchema() { name: z .string() .min(1, { - message: t('common.namePlaceholder'), + message: t('common.mcp.namePlaceholder'), + }) + .regex(/^[a-zA-Z0-9_-]{1,64}$/, { + message: t('common.mcp.nameRequired'), }) .trim(), url: z .string() .url() .min(1, { - message: t('common.namePlaceholder'), + message: t('common.mcp.urlPlaceholder'), }) .trim(), server_type: z .string() .min(1, { - message: t('common.namePlaceholder'), + message: t('common.pleaseSelect'), }) .trim(), authorization_token: z.string().optional(), @@ -89,7 +92,7 @@ export function EditMcpForm({ {t('common.name')} @@ -106,7 +109,7 @@ export function EditMcpForm({ {t('mcp.url')} { @@ -148,7 +151,7 @@ export function EditMcpForm({ Authorization Token