From ac1376ede5c5073ec42e2411d7291f45daef7e38 Mon Sep 17 00:00:00 2001 From: LobeHub Bot Date: Sat, 7 Mar 2026 17:45:18 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8C=90=20chore:=20translate=20non-English?= =?UTF-8?q?=20comments=20to=20English=20in=20ProtocolUrlHandler=20(#12781)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../InstallPlugin/ConfigDisplay.tsx | 20 ++++++++-------- .../CustomPluginInstallModal.tsx | 24 +++++++++---------- .../OfficialPluginInstallModal/index.tsx | 8 +++---- .../InstallPlugin/index.tsx | 8 +++---- .../ProtocolUrlHandler/InstallPlugin/types.ts | 2 +- src/features/ProtocolUrlHandler/index.tsx | 2 +- 6 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/features/ProtocolUrlHandler/InstallPlugin/ConfigDisplay.tsx b/src/features/ProtocolUrlHandler/InstallPlugin/ConfigDisplay.tsx index 03b00c76ed..211e45ad5a 100644 --- a/src/features/ProtocolUrlHandler/InstallPlugin/ConfigDisplay.tsx +++ b/src/features/ProtocolUrlHandler/InstallPlugin/ConfigDisplay.tsx @@ -102,19 +102,19 @@ interface ConfigDisplayProps { const ConfigDisplay = memo(({ schema, onConfigUpdate }) => { const { t } = useTranslation('plugin'); - // 本地状态管理配置数据 + // Local state management for config data const [currentEnv, setCurrentEnv] = useState>(schema.config.env || {}); const [currentHeaders, setCurrentHeaders] = useState>( schema.config.headers || {}, ); - // 处理环境变量更新 + // Handle environment variable updates const handleEnvUpdate = (newEnv: Record) => { setCurrentEnv(newEnv); onConfigUpdate?.({ env: newEnv, headers: currentHeaders }); }; - // 处理 Headers 更新 + // Handle Headers updates const handleHeadersUpdate = (newHeaders: Record) => { setCurrentHeaders(newHeaders); onConfigUpdate?.({ env: currentEnv, headers: newHeaders }); @@ -122,7 +122,7 @@ const ConfigDisplay = memo(({ schema, onConfigUpdate }) => { return ( - {/* 安装信息 */} + {/* Installation info */}
@@ -130,7 +130,7 @@ const ConfigDisplay = memo(({ schema, onConfigUpdate }) => {
- {/* 连接类型 */} + {/* Connection type */}
{t('protocolInstall.config.type.label')}
@@ -140,7 +140,7 @@ const ConfigDisplay = memo(({ schema, onConfigUpdate }) => {
- {/* HTTP 类型显示 URL */} + {/* HTTP type shows URL */} {schema.config.type === 'http' && schema.config.url && (
{t('protocolInstall.config.url')} @@ -148,7 +148,7 @@ const ConfigDisplay = memo(({ schema, onConfigUpdate }) => {
)} - {/* STDIO 类型显示命令和参数 */} + {/* STDIO type shows command and args */} {schema.config.type === 'stdio' && ( <> {schema.config.command && ( @@ -169,7 +169,7 @@ const ConfigDisplay = memo(({ schema, onConfigUpdate }) => {
- {/* 配置信息 - 直接使用 KeyValueEditor */} + {/* Config info - directly use KeyValueEditor */}
@@ -179,7 +179,7 @@ const ConfigDisplay = memo(({ schema, onConfigUpdate }) => {
- {/* HTTP 类型显示 Headers */} + {/* HTTP type shows Headers */} {schema.config.type === 'http' && ( (({ schema, onConfigUpdate }) => { /> )} - {/* STDIO 类型显示环境变量 */} + {/* STDIO type shows environment variables */} {schema.config.type === 'stdio' && ( ( const { t } = useTranslation('plugin'); const [loading, setLoading] = useState(false); - // 跟踪配置更新 + // Track config updates const [updatedConfig, setUpdatedConfig] = useState<{ env?: Record; headers?: Record; @@ -39,7 +39,7 @@ const CustomPluginInstallModal = memo( const testMcpConnection = useToolStore((s) => s.testMcpConnection); const togglePlugin = useAgentStore((s) => s.togglePlugin); - // 为自定义插件测试连接生成唯一标识符 + // Generate a unique identifier for custom plugin connection testing const identifier = installRequest?.schema?.identifier || ''; const testState = useToolStore(mcpStoreSelectors.getMCPConnectionTestState(identifier)); @@ -48,7 +48,7 @@ const CustomPluginInstallModal = memo( const marketplace = isMarketplace && marketId ? TRUSTED_MARKETPLACES[marketId as TrustedMarketplaceId] : null; - // 重置加载状态和配置 + // Reset loading state and config useEffect(() => { if (!installRequest) { setLoading(false); @@ -61,14 +61,14 @@ const CustomPluginInstallModal = memo( setLoading(true); try { - // 合并原始配置和用户更新的配置 + // Merge original config with user-updated config const finalConfig = { ...schema.config, env: updatedConfig.env || schema.config.env, headers: updatedConfig.headers || schema.config.headers, }; - // 自定义插件:先测试连接获取真实的 manifest + // Custom plugin: test connection first to get the real manifest const testParams: McpConnectionParams = { connection: finalConfig, identifier, @@ -88,19 +88,19 @@ const CustomPluginInstallModal = memo( throw new Error(t('protocolInstall.messages.manifestNotFound')); } - // 第三方市场和自定义插件:构建自定义插件数据 - // 使用测试连接获取的真实 manifest + // Third-party marketplace and custom plugins: build custom plugin data + // Use the real manifest obtained from connection testing const customPlugin: LobeToolCustomPlugin = { customParams: { avatar: schema.icon, description: schema.description, mcp: { - ...finalConfig, // 使用合并后的配置 + ...finalConfig, // Use the merged config headers: finalConfig.type === 'http' ? finalConfig.headers : undefined, }, }, identifier: schema.identifier, - manifest: testResult.manifest, // 使用真实的 manifest + manifest: testResult.manifest, // Use the real manifest type: 'customPlugin', }; @@ -133,7 +133,7 @@ const CustomPluginInstallModal = memo( if (!installRequest || !schema) return null; - // 根据类型渲染不同的 Alert 组件 + // Render different Alert components based on type const renderAlert = () => { if (!isMarketplace) { return ( @@ -146,7 +146,7 @@ const CustomPluginInstallModal = memo( ); } - // marketplace 类型 + // marketplace type return marketplace ? ( ( - {/* 显示测试连接错误 */} + {/* Show connection test error */} {testState.error && ( ( const { t } = useTranslation(['plugin', 'common']); const [loading, setLoading] = useState(false); - // 获取 MCP 插件详情 + // Fetch MCP plugin details const useMcpDetail = useDiscoverStore((s) => s.useFetchMcpDetail); const identifier = installRequest?.pluginId || ''; @@ -59,14 +59,14 @@ const OfficialPluginInstallModal = memo( if (!installRequest) return null; - // 渲染内容 + // Render content const renderContent = () => { - // 如果正在加载,显示骨架屏 + // If loading, show skeleton screen if (isLoading || !identifier) { return ; } - // 如果加载失败或没有数据,显示错误信息 + // If loading failed or no data, show error message if (!data) { return ( diff --git a/src/features/ProtocolUrlHandler/InstallPlugin/index.tsx b/src/features/ProtocolUrlHandler/InstallPlugin/index.tsx index d56bf33507..82b1639ad8 100644 --- a/src/features/ProtocolUrlHandler/InstallPlugin/index.tsx +++ b/src/features/ProtocolUrlHandler/InstallPlugin/index.tsx @@ -13,22 +13,22 @@ interface PluginInstallConfirmModalProps { } /** - * 根据安装请求的来源确定插件类型 + * Determine plugin type based on the source of the install request */ const getPluginSource = (request: McpInstallRequest): PluginSource => { const { marketId } = request; - // 官方 LobeHub 插件 + // Official LobeHub plugin if (marketId === 'lobehub') { return PluginSource.OFFICIAL; } - // 第三方市场插件(包括可信和不可信的) + // Third-party marketplace plugin (including trusted and untrusted) if (marketId && marketId !== 'lobehub') { return PluginSource.MARKETPLACE; } - // 自定义插件(没有 marketId) + // Custom plugin (no marketId) return PluginSource.CUSTOM; }; diff --git a/src/features/ProtocolUrlHandler/InstallPlugin/types.ts b/src/features/ProtocolUrlHandler/InstallPlugin/types.ts index 737d9df4a3..a6280479bb 100644 --- a/src/features/ProtocolUrlHandler/InstallPlugin/types.ts +++ b/src/features/ProtocolUrlHandler/InstallPlugin/types.ts @@ -23,7 +23,7 @@ export interface ModalConfig { width?: number; } -// 可信的第三方市场列表 +// List of trusted third-party marketplaces export const TRUSTED_MARKETPLACES = { higress: { description: 'Enterprise-grade MCP plugins for cloud-native applications', diff --git a/src/features/ProtocolUrlHandler/index.tsx b/src/features/ProtocolUrlHandler/index.tsx index 4fbf91c33a..70542dac85 100644 --- a/src/features/ProtocolUrlHandler/index.tsx +++ b/src/features/ProtocolUrlHandler/index.tsx @@ -12,7 +12,7 @@ const ProtocolUrlHandler = () => { const handleMcpInstallRequest = useCallback( (data: { marketId?: string; pluginId: string; schema: any }) => { - // 将原始数据传递给子组件处理 + // Pass raw data to child component for processing setInstallRequest(data as McpInstallRequest); }, [],