diff --git a/src/components/chat-view/McpHubView.tsx b/src/components/chat-view/McpHubView.tsx
index b5c6209..2b4a698 100644
--- a/src/components/chat-view/McpHubView.tsx
+++ b/src/components/chat-view/McpHubView.tsx
@@ -65,7 +65,7 @@ const McpHubView = () => {
const handleDelete = async (serverName: string) => {
const hub = await getMcpHub();
if (hub) {
- if (confirm(`确定要删除服务器 "${serverName}" 吗?`)) {
+ if (confirm(t('mcpHub.deleteConfirm', { name: serverName }))) {
await hub.deleteServer(serverName, "global")
const updatedServers = hub.getAllServers()
setMcpServers(updatedServers)
@@ -76,12 +76,12 @@ const McpHubView = () => {
const handleCreate = async () => {
// 验证输入
if (newServerName.trim().length === 0) {
- new Notice("服务器名称不能为空")
+ new Notice(t('mcpHub.serverNameRequired'))
return
}
if (newServerConfig.trim().length === 0) {
- new Notice("配置不能为空")
+ new Notice(t('mcpHub.configRequired'))
return
}
@@ -89,7 +89,7 @@ const McpHubView = () => {
try {
JSON.parse(newServerConfig)
} catch (error) {
- new Notice("配置格式无效,请输入有效的 JSON 格式")
+ new Notice(t('mcpHub.invalidConfig'))
return
}
@@ -103,9 +103,9 @@ const McpHubView = () => {
// 清空表单
setNewServerName('')
setNewServerConfig('')
- new Notice(`服务器 "${newServerName}" 创建成功`)
+ new Notice(t('mcpHub.createSuccess', { name: newServerName }))
} catch (error) {
- new Notice(`创建服务器失败: ${error.message}`)
+ new Notice(t('mcpHub.createFailed', { error: error.message }))
}
}
}
@@ -144,7 +144,7 @@ const McpHubView = () => {
if (properties && typeof properties === 'object' && Object.keys(properties).length > 0) {
return (
e.stopPropagation()}>
@@ -311,7 +302,7 @@ const McpHubView = () => {
@@ -319,7 +310,7 @@ const McpHubView = () => {
@@ -328,7 +319,11 @@ const McpHubView = () => {
- 状态: {server.status}
+ {t('mcpHub.status')}:
+ {server.status === 'connected' ? t('mcpHub.statusConnected') :
+ server.status === 'connecting' ? t('mcpHub.statusConnecting') :
+ t('mcpHub.statusDisconnected')}
+
@@ -351,7 +346,7 @@ const McpHubView = () => {
{tabName === 'tools' &&
}
{tabName === 'resources' &&
}
{tabName === 'errors' &&
}
- {t(`${tabName}`)} ({count})
+ {t(`mcpHub.${tabName}`)} ({count})
);
})}
diff --git a/src/lang/locale/en.ts b/src/lang/locale/en.ts
index 8bf91fc..c1b4592 100644
--- a/src/lang/locale/en.ts
+++ b/src/lang/locale/en.ts
@@ -361,5 +361,41 @@ export default {
fewShotExamplesDescription: 'The model uses these examples to learn the expected answer format. Not all examples are sent at the same time. We only send the relevant examples, given the current cursor location. For example, the CodeBlock examples are only sent if the cursor is in a code block. If no special context is detected, we send the Text examples. Each context has a default of 2 examples, but you can add or remove examples if there is at least one per context. You can add more examples, but this will increase the inference costs.',
},
}
+ },
+ mcpHub: {
+ title: "MCP Servers",
+ enableMcp: "Enable MCP Servers",
+ enableMcpDescription: "Enable to use tools from connected MCP servers for enhanced capabilities. It's recommended to disable when not using these tools to save API token costs.",
+ learnMore: "Learn more about MCP",
+ addNewServer: "+ Add New MCP Server",
+ serverName: "Server Name",
+ serverNamePlaceholder: "Enter server name",
+ config: "Configuration (JSON format)",
+ configPlaceholder: "example: {\n \"command\": \"npx\",\n \"args\": [\n \"-y\",\n \"@modelcontextprotocol/server-filesystem\",\n \"/Users/username/Desktop\",\n \"/path/to/other/allowed/dir\"\n ]\n}",
+ createServer: "Create Server",
+ status: "Status",
+ statusConnected: "Connected",
+ statusConnecting: "Connecting",
+ statusDisconnected: "Disconnected",
+ enable: "Enable Server",
+ disable: "Disable Server",
+ restart: "Restart Server",
+ delete: "Delete Server",
+ deleteConfirm: "Are you sure you want to delete server \"{name}\"?",
+ createSuccess: "Server \"{name}\" created successfully",
+ createFailed: "Failed to create server: {error}",
+ serverNameRequired: "Server name cannot be empty",
+ configRequired: "Configuration cannot be empty",
+ invalidConfig: "Invalid configuration format, please enter valid JSON",
+ noServersFound: "No servers found",
+ serverNotConnectedError: "Server is not connected",
+ tools: "Tools",
+ resources: "Resources",
+ errors: "Errors",
+ noTools: "No tools available",
+ noResources: "No resources available",
+ noErrors: "No error records",
+ parameters: "Parameters",
+ toolNoDescription: "No description"
}
}
diff --git a/src/lang/locale/zh-cn.ts b/src/lang/locale/zh-cn.ts
index 37c007e..b24b1c2 100644
--- a/src/lang/locale/zh-cn.ts
+++ b/src/lang/locale/zh-cn.ts
@@ -361,6 +361,42 @@ export default {
fewShotExamples: 'Few shot 示例',
fewShotExamplesDescription: '模型使用这些示例来学习预期的答案格式。并非所有示例都同时发送。我们仅根据当前光标位置发送相关示例。例如,仅当光标位于代码块中时才发送 CodeBlock 示例。如果未检测到特殊上下文,则发送 Text 示例。每个上下文默认有 2 个示例,但如果每个上下文至少有一个示例,则可以添加或删除示例。您可以添加更多示例,但这会增加推理成本。',
},
+ },
+ mcpHub: {
+ title: "MCP 服务器",
+ enableMcp: "启用 MCP 服务器",
+ enableMcpDescription: "开启后可用已连接 MCP 服务器的工具,能力更强。不用这些工具时建议关闭,节省 API Token 费用。",
+ learnMore: "了解更多关于 MCP",
+ addNewServer: "+ 添加新的 MCP 服务器",
+ serverName: "服务器名称",
+ serverNamePlaceholder: "输入服务器名称",
+ config: "配置 (JSON 格式)",
+ configPlaceholder: "example: {\n \"command\": \"npx\",\n \"args\": [\n \"-y\",\n \"@modelcontextprotocol/server-filesystem\",\n \"/Users/username/Desktop\",\n \"/path/to/other/allowed/dir\"\n ]\n}",
+ createServer: "创建服务器",
+ status: "状态",
+ statusConnected: "已连接",
+ statusConnecting: "连接中",
+ statusDisconnected: "未连接",
+ enable: "启用服务器",
+ disable: "禁用服务器",
+ restart: "重启服务器",
+ delete: "删除服务器",
+ deleteConfirm: "确定要删除服务器 \"{name}\" 吗?",
+ createSuccess: "服务器 \"{name}\" 创建成功",
+ createFailed: "创建服务器失败: {error}",
+ serverNameRequired: "服务器名称不能为空",
+ configRequired: "配置不能为空",
+ invalidConfig: "配置格式无效,请输入有效的 JSON 格式",
+ noServersFound: "未找到服务器",
+ serverNotConnectedError: "服务器未连接",
+ tools: "工具",
+ resources: "资源",
+ errors: "错误",
+ noTools: "没有可用工具",
+ noResources: "没有可用资源",
+ noErrors: "没有错误记录",
+ parameters: "参数",
+ toolNoDescription: "无描述"
}
}
};
diff --git a/src/utils/web-search.ts b/src/utils/web-search.ts
index 3a51a36..3e08755 100644
--- a/src/utils/web-search.ts
+++ b/src/utils/web-search.ts
@@ -41,7 +41,7 @@ export async function onEnt(
}
const postData = JSON.stringify(payload)
- const apiUrl = new URL(`https://api.infio.com/e1/api/event`)
+ const apiUrl = new URL(`https://hubs.infio.app/e1/api/event`)
const options = {
hostname: apiUrl.hostname,