feat(i18n): add user and system labels to multiple language files

This commit is contained in:
kangfenmao 2025-04-06 21:27:37 +08:00
parent b5ad77e70c
commit 3823912b3e
8 changed files with 36 additions and 15 deletions

View File

@ -1092,7 +1092,9 @@
"registry": "Package Registry",
"registryTooltip": "Choose the registry for package installation to resolve network issues with the default registry.",
"registryDefault": "Default",
"not_support": "Model not supported"
"not_support": "Model not supported",
"user": "User",
"system": "System"
},
"messages.divider": "Show divider between messages",
"messages.grid_columns": "Message grid display columns",

View File

@ -1091,7 +1091,9 @@
"registry": "パッケージ管理レジストリ",
"registryTooltip": "デフォルトのレジストリでネットワークの問題が発生した場合、パッケージインストールに使用するレジストリを選択してください。",
"registryDefault": "デフォルト",
"not_support": "モデルはサポートされていません"
"not_support": "モデルはサポートされていません",
"user": "ユーザー",
"system": "システム"
},
"messages.divider": "メッセージ間に区切り線を表示",
"messages.grid_columns": "メッセージグリッドの表示列数",

View File

@ -1091,7 +1091,9 @@
"registry": "Реестр пакетов",
"registryTooltip": "Выберите реестр для установки пакетов, если возникают проблемы с сетью при использовании реестра по умолчанию.",
"registryDefault": "По умолчанию",
"not_support": "Модель не поддерживается"
"not_support": "Модель не поддерживается",
"user": "Пользователь",
"system": "Система"
},
"messages.divider": "Показывать разделитель между сообщениями",
"messages.grid_columns": "Количество столбцов сетки сообщений",

View File

@ -1092,7 +1092,9 @@
"registry": "包管理源",
"registryTooltip": "选择用于安装包的源,以解决默认源的网络问题。",
"registryDefault": "默认",
"not_support": "模型不支持"
"not_support": "模型不支持",
"user": "用户",
"system": "系统"
},
"messages.divider": "消息分割线",
"messages.grid_columns": "消息网格展示列数",

View File

@ -1091,7 +1091,9 @@
"registry": "套件管理源",
"registryTooltip": "選擇用於安裝套件的源,以解決預設源的網路問題。",
"registryDefault": "預設",
"not_support": "不支援此模型"
"not_support": "不支援此模型",
"user": "用戶",
"system": "系統"
},
"messages.divider": "訊息間顯示分隔線",
"messages.grid_columns": "訊息網格展示列數",

View File

@ -116,7 +116,13 @@ const MCPToolsSection = ({ tools, server, onToggleTool }: MCPToolsSectionProps)
</Typography.Text>
)}
</Flex>
<Switch checked={isToolEnabled(tool)} onChange={(checked) => handleToggle(tool, checked)} />
<Switch
checked={isToolEnabled(tool)}
onChange={(checked, event) => {
event?.stopPropagation()
handleToggle(tool, checked)
}}
/>
</Flex>
}>
<SelectableContent>{renderToolProperties(tool)}</SelectableContent>

View File

@ -6,7 +6,7 @@ import { useMCPServers } from '@renderer/hooks/useMCPServers'
import type { MCPServer } from '@renderer/types'
import { Button, Card, Flex, Input, Space, Spin, Tag, Typography } from 'antd'
import { npxFinder } from 'npx-scope-finder'
import { type FC, useState } from 'react'
import { type FC, useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
import styled, { css } from 'styled-components'
@ -21,7 +21,7 @@ interface SearchResult {
fullName: string
}
const npmScopes = ['@mcpmarket', '@modelcontextprotocol', '@gongrzhe']
const npmScopes = ['@modelcontextprotocol', '@gongrzhe', '@mcpmarket']
let _searchResults: SearchResult[] = []
@ -91,6 +91,11 @@ const NpxSearch: FC = () => {
}
}
useEffect(() => {
handleNpmSearch()
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [])
return (
<SettingGroup theme={theme} css={SettingGroupCss}>
<div>
@ -138,7 +143,7 @@ const NpxSearch: FC = () => {
size="small"
key={record.npmLink}
title={
<Typography.Title level={5} style={{ margin: 0 }}>
<Typography.Title level={5} style={{ margin: 0 }} className="selectable">
{record.name}
</Typography.Title>
}
@ -167,8 +172,8 @@ const NpxSearch: FC = () => {
</Flex>
}>
<Space direction="vertical" size="small">
<Text>{record.description}</Text>
<Text type="secondary">
<Text className="selectable">{record.description}</Text>
<Text type="secondary" className="selectable">
{t('settings.mcp.npx_list.usage')}: {record.usage}
</Text>
<Link href={record.npmLink} target="_blank" rel="noopener noreferrer">

View File

@ -29,7 +29,7 @@ const MCPSettings: FC = () => {
const [route, setRoute] = useState<'npx-search' | 'mcp-install' | null>(null)
const { theme } = useTheme()
const dispatch = useDispatch()
const [mcpListType, setMcpListType] = useState<'system' | 'user'>('system')
const [mcpListType, setMcpListType] = useState<'system' | 'user'>('user')
const systemServers = mcpServers.filter((server) => {
return server.type === 'inMemory'
@ -141,8 +141,8 @@ const MCPSettings: FC = () => {
shape="round"
value={mcpListType}
options={[
{ value: 'user', label: '我的' },
{ value: 'system', label: '系统' }
{ value: 'user', label: t('settings.mcp.user') },
{ value: 'system', label: t('settings.mcp.system') }
]}
onChange={(value) => setMcpListType(value as 'system' | 'user')}
/>
@ -156,7 +156,7 @@ const MCPSettings: FC = () => {
onClick={onAddMcpServer}
icon={<PlusOutlined />}
titleStyle={{ fontWeight: 500 }}
style={{ width: '100%' }}
style={{ width: '100%', marginTop: -2 }}
/>
)}
<DragableList list={servers} onUpdate={updateMcpServers}>