Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions frontend/src/lang/modules/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2605,8 +2605,8 @@ const message = {
},
mcp: {
server: 'MCP Server',
create: 'Add Server',
edit: 'Edit Server',
create: 'Add MCP Server',
edit: 'Edit MCP Server',
commandHelper: 'For example: npx -y {0}',
baseUrl: 'External Access Path',
baseUrlHelper: 'For example: https://127.0.0.1:8080',
Expand Down
10 changes: 5 additions & 5 deletions frontend/src/lang/modules/tw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2439,14 +2439,14 @@ const message = {
whiteListHelper: '限制僅白名單中的 IP 可瀏覽',
},
mcp: {
server: 'MCP 伺服器',
create: '添加伺服器',
edit: '編輯伺服器',
server: 'MCP Server',
create: '创建 MCP Server',
edit: '編輯 MCP Server',
commandHelper: '例如:npx -y {0}',
baseUrl: '外部訪問路徑',
baseUrlHelper: '例如:https://127.0.0.1:8080',
ssePath: 'SSE 路徑',
ssePathHelper: '例如:/sse,注意不要與其他伺服器重複',
ssePathHelper: '例如:/sse,注意不要與其他 Server 重複',
environment: '環境變數',
envKey: '變數名',
envValue: '變數值',
Expand All @@ -2456,7 +2456,7 @@ const message = {
domainHelper: '例如:192.168.1.1 或者 example.com',
bindDomain: '綁定網站',
commandPlaceHolder: '當前僅支持 npx 和二進制啟動的命令',
importMcpJson: '導入 MCP 伺服器配置',
importMcpJson: '導入 MCP Server配置',
importMcpJsonError: 'mcpServers 結構不正確',
},
};
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are no major coding style violations in this code snippet. However, there are some minor suggestions for improvement:

  1. File Type: It may be beneficial to change the file extension from .js to .ts if message.js is meant to be TypeScript. This will improve type safety and make it easier to manage with modern JavaScript frameworks or tools.

  2. Spellings:

    • "whiteListHelper" should be corrected to "whitelistHelper".
    • In "ssePathHelper": "例如:/sse, 注意不要與其他 伺服器 重複",, the Chinese characters "伺服器" (server) should remain unchanged but ensure they match the locale of your application if used elsewhere.
  3. Consistency:

    • The sentence structure between different key-value pairs within each object can vary slightly. Consistency might help readability when reviewing changes later.
    • Consider using consistent quotation marks throughout the strings. In JavaScript, single quotes (') and double quotes (") are interchangeable, but you could choose one convention and stick with it across the entire localization file.

Overall, the code looks well-formatted and functional based on the provided context. If this is part of a larger project that heavily relies on internationalization (i18n), ensuring consistency and completeness of translations would be crucial for user experience.

Expand Down
10 changes: 5 additions & 5 deletions frontend/src/lang/modules/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2441,14 +2441,14 @@ const message = {
whiteListHelper: '限制仅白名单中的 IP 可访问',
},
mcp: {
server: 'MCP 服务器',
create: '添加服务器',
edit: '编辑服务器',
server: 'MCP Server',
create: '创建 MCP Server',
edit: '编辑 MCP Server',
commandHelper: '例如:npx -y {0}',
baseUrl: '外部访问路径',
baseUrlHelper: '例如:https://127.0.0.1:8080',
ssePath: 'SSE 路径',
ssePathHelper: '例如:/sse,注意不要与其他服务器重复',
ssePathHelper: '例如:/sse,注意不要与其他 Server 重复',
environment: '环境变量',
envKey: '变量名',
envValue: '变量值',
Expand All @@ -2458,7 +2458,7 @@ const message = {
domainHelper: '例如:192.168.1.1 或者 example.com',
bindDomain: '绑定网站',
commandPlaceHolder: '当前仅支持 npx 和二进制启动的命令',
importMcpJson: '导入 MCP 服务器配置',
importMcpJson: '导入 MCP Server 配置',
importMcpJsonError: 'mcpServers 结构不正确',
},
};
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code has several minor issues and improvements that can be made:

  1. Consistency in Capitalization:

    • "白名单中的" should be consistently capitalized as "White-listed".
  2. Variable Name Corrections:

    • "bindDomain" to "bindingDomain"
  3. Command Placeholder Text:

    • The placeholder text could be more detailed, such as "e.g.: npm start --prefix ./path/to/project /usr/local/sbin/start-app.sh".
  4. General Clean-up:

    • Ensure consistency throughout similar messages.

Here is the revised version of the message object with these changes:

const message = {
    whiteListHelper: '限制仅白名单中的 IP 访问',
    mcp: {
        server: 'MCP Server',
        create: '创建 MCP Server',
        edit: '编辑 MCP Server',
        commandHelper: '例如:npx [-y] {0}',
        baseUrl: '外部访问路径',
        baseUrlHelper: '例如:https://127.0.0.1:8080',
        ssePath: 'SSE 路径',
        ssePathHelper: '例如:/sse, 注意不要与其他服务器重复',
        environment: '环境变量',
        envKey: '变量名',
        envValue: '变量值',
    },
    domains: {
        name: '域名管理',
        importDomainsBtnTxt: '导入域名列表(CSV 文件)',
        addDomainTextTitle: '添加新网站域',
        bindingDomainTextTitle: '修改绑定 website 的域名',
        domainHelper: '例如:192.168.1.1,或 example.com',
        bindDomain: '绑定网站',
        commandPlaceHolder: '例如:npm 选项前缀项目路径 /usr/local/sbin/bin-file',
        importMcpJson: '导入 MCP Server 配置',
        importMcpJsonError: 'mcpServers 架构不正确',
    },
};

These changes improve readability and maintainability while addressing specific formatting issues.

Expand Down
16 changes: 8 additions & 8 deletions frontend/src/routers/modules/ai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@ const databaseRouter = {
},
},
{
path: '/ai/gpu',
name: 'GPU',
component: () => import('@/views/ai/gpu/index.vue'),
path: '/ai/mcp',
name: 'MCPServer',
component: () => import('@/views/ai/mcp/server/index.vue'),
meta: {
title: 'ai_tools.gpu.gpu',
title: 'MCP',
requiresAuth: true,
},
},
{
path: '/ai/mcp',
name: 'MCPServer',
component: () => import('@/views/ai/mcp/server/index.vue'),
path: '/ai/gpu',
name: 'GPU',
component: () => import('@/views/ai/gpu/index.vue'),
meta: {
title: 'MCP',
title: 'ai_tools.gpu.gpu',
requiresAuth: true,
},
},
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are no apparent irregularities, potential issues, or optimization opportunities in the provided code changes. The paths /ai/gpu and /ai/mcp have been correctly swapped between their names, components, and metadata.

Expand Down
4 changes: 1 addition & 3 deletions frontend/src/views/ai/mcp/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@
</template>

<script lang="ts" setup>
import i18n from '@/lang';

const buttons = [
{
label: i18n.global.t('container.server'),
label: 'Servers',
path: '/ai/mcp/servers',
},
];
Expand Down
7 changes: 5 additions & 2 deletions frontend/src/views/ai/mcp/server/index.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div>
<RouterMenu />
<LayoutContent :title="$t('container.server')" v-loading="loading">
<LayoutContent :title="'Servers'" v-loading="loading">
<template #toolbar>
<div class="flex flex-wrap gap-3">
<el-button type="primary" @click="openCreate">
Expand Down Expand Up @@ -189,7 +189,10 @@ const openDetail = (row: AI.McpServer) => {
};

const openCreate = () => {
const maxPort = Math.max(...items.value.map((item) => item.port));
let maxPort = 8000;
if (items.value && items.value.length > 0) {
maxPort = Math.max(...items.value.map((item) => item.port));
}
createRef.value.acceptParams({ port: maxPort + 1 });
};

Expand Down
Loading