Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🌐 chore: translate non-English comments to English in ProtocolUrlHandler (#12781)

LobeHub Botac1376ede5c5
diff --git a/src/features/ProtocolUrlHandler/InstallPlugin/ConfigDisplay.tsx b/src/features/ProtocolUrlHandler/InstallPlugin/ConfigDisplay.tsx
index 03b00c76ed2..211e45ad5ad 100644
--- a/src/features/ProtocolUrlHandler/InstallPlugin/ConfigDisplay.tsx
+++ b/src/features/ProtocolUrlHandler/InstallPlugin/ConfigDisplay.tsx
@@ -102,19 +102,19 @@ interface ConfigDisplayProps {
const ConfigDisplay = memo<ConfigDisplayProps>(({ schema, onConfigUpdate }) => {
const { t } = useTranslation('plugin');
- // 本地状态管理配置数据
+ // Local state management for config data
const [currentEnv, setCurrentEnv] = useState<Record<string, string>>(schema.config.env || {});
const [currentHeaders, setCurrentHeaders] = useState<Record<string, string>>(
schema.config.headers || {},
);
- // 处理环境变量更新
+ // Handle environment variable updates
const handleEnvUpdate = (newEnv: Record<string, string>) => {
setCurrentEnv(newEnv);
onConfigUpdate?.({ env: newEnv, headers: currentHeaders });
};
- // 处理 Headers 更新
+ // Handle Headers updates
const handleHeadersUpdate = (newHeaders: Record<string, string>) => {
setCurrentHeaders(newHeaders);
onConfigUpdate?.({ env: currentEnv, headers: newHeaders });
@@ -122,7 +122,7 @@ const ConfigDisplay = memo<ConfigDisplayProps>(({ schema, onConfigUpdate }) => {
return (
<Flexbox gap={16}>
- {/* 安装信息 */}
+ {/* Installation info */}
<Block className={styles.configSection} variant={'outlined'}>
<div className={styles.configTitle}>
<LinkIcon size={14} />
@@ -130,7 +130,7 @@ const ConfigDisplay = memo<ConfigDisplayProps>(({ schema, onConfigUpdate }) => {
</div>
<div className={styles.previewContainer}>
- {/* 连接类型 */}
+ {/* Connection type */}
<div className={styles.previewItem}>
<span className={styles.previewLabel}>{t('protocolInstall.config.type.label')}</span>
<div className={styles.typeValue}>
@@ -140,7 +140,7 @@ const ConfigDisplay = memo<ConfigDisplayProps>(({ schema, onConfigUpdate }) => {
</div>
</div>
- {/* HTTP 类型显示 URL */}
+ {/* HTTP type shows URL */}
{schema.config.type === 'http' && schema.config.url && (
<div className={styles.previewItem}>
<span className={styles.previewLabel}>{t('protocolInstall.config.url')}</span>
@@ -148,7 +148,7 @@ const ConfigDisplay = memo<ConfigDisplayProps>(({ schema, onConfigUpdate }) => {
</div>
)}
- {/* STDIO 类型显示命令和参数 */}
+ {/* STDIO type shows command and args */}
{schema.config.type === 'stdio' && (
<>
{schema.config.command && (
@@ -169,7 +169,7 @@ const ConfigDisplay = memo<ConfigDisplayProps>(({ schema, onConfigUpdate }) => {
</div>
</Block>
- {/* 配置信息 - 直接使用 KeyValueEditor */}
+ {/* Config info - directly use KeyValueEditor */}
<Block className={styles.configSection} variant={'outlined'}>
<div className={styles.configTitle}>
<Settings2Icon size={14} />
@@ -179,7 +179,7 @@ const ConfigDisplay = memo<ConfigDisplayProps>(({ schema, onConfigUpdate }) => {
</div>
<div className={styles.configEditor}>
- {/* HTTP 类型显示 Headers */}
+ {/* HTTP type shows Headers */}
{schema.config.type === 'http' && (
<KeyValueEditor
addButtonText={t('protocolInstall.config.addHeaders')}
@@ -189,7 +189,7 @@ const ConfigDisplay = memo<ConfigDisplayProps>(({ schema, onConfigUpdate }) => {
/>
)}
- {/* STDIO 类型显示环境变量 */}
+ {/* STDIO type shows environment variables */}
{schema.config.type === 'stdio' && (
<KeyValueEditor
addButtonText={t('protocolInstall.config.addEnv')}
diff --git a/src/features/ProtocolUrlHandler/InstallPlugin/CustomPluginInstallModal.tsx b/src/features/ProtocolUrlHandler/InstallPlugin/CustomPluginInstallModal.tsx
index ca926de8452..d44a42a732c 100644
--- a/src/features/ProtocolUrlHandler/InstallPlugin/CustomPluginInstallModal.tsx
+++ b/src/features/ProtocolUrlHandler/InstallPlugin/CustomPluginInstallModal.tsx
@@ -29,7 +29,7 @@ const CustomPluginInstallModal = memo<CustomPluginInstallModalProps>(
const { t } = useTranslation('plugin');
const [loading, setLoading] = useState(false);
- // 跟踪配置更新
+ // Track config updates
const [updatedConfig, setUpdatedConfig] = useState<{
env?: Record<string, string>;
headers?: Record<string, string>;
@@ -39,7 +39,7 @@ const CustomPluginInstallModal = memo<CustomPluginInstallModalProps>(
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<CustomPluginInstallModalProps>(
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<CustomPluginInstallModalProps>(
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<CustomPluginInstallModalProps>(
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<CustomPluginInstallModalProps>(
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<CustomPluginInstallModalProps>(
);
}
- // marketplace 类型
+ // marketplace type
return marketplace ? (
<Alert
showIcon
@@ -202,7 +202,7 @@ const CustomPluginInstallModal = memo<CustomPluginInstallModalProps>(
<Flexbox>
<ConfigDisplay schema={schema} onConfigUpdate={setUpdatedConfig} />
- {/* 显示测试连接错误 */}
+ {/* Show connection test error */}
{testState.error && (
<Alert
closable
diff --git a/src/features/ProtocolUrlHandler/InstallPlugin/OfficialPluginInstallModal/index.tsx b/src/features/ProtocolUrlHandler/InstallPlugin/OfficialPluginInstallModal/index.tsx
index 14cf8476e6d..9faf55425ae 100644
--- a/src/features/ProtocolUrlHandler/InstallPlugin/OfficialPluginInstallModal/index.tsx
+++ b/src/features/ProtocolUrlHandler/InstallPlugin/OfficialPluginInstallModal/index.tsx
@@ -25,7 +25,7 @@ const OfficialPluginInstallModal = memo<OfficialPluginInstallModalProps>(
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<OfficialPluginInstallModalProps>(
if (!installRequest) return null;
- // 渲染内容
+ // Render content
const renderContent = () => {
- // 如果正在加载,显示骨架屏
+ // If loading, show skeleton screen
if (isLoading || !identifier) {
return <DetailLoading />;
}
- // 如果加载失败或没有数据,显示错误信息
+ // If loading failed or no data, show error message
if (!data) {
return (
<Block>
diff --git a/src/features/ProtocolUrlHandler/InstallPlugin/index.tsx b/src/features/ProtocolUrlHandler/InstallPlugin/index.tsx
index d56bf335071..82b1639ad8b 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 737d9df4a31..a6280479bb0 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 4fbf91c33a2..70542dac852 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);
},
[],