From fb9f6d1d00e7b4f792498aea06f6bbcf3bc133d0 Mon Sep 17 00:00:00 2001 From: lanyuanxiaoyao Date: Thu, 7 May 2026 15:05:45 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E7=BB=9F=E8=AE=A1=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E6=94=B9=E5=90=8D=E4=B8=BA"=E6=80=BB=E8=A7=88"?= =?UTF-8?q?=E5=B9=B6=E6=8F=90=E5=8D=87=E8=87=B3=E4=BE=A7=E8=BE=B9=E6=A0=8F?= =?UTF-8?q?=E9=A6=96=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将侧边栏"用量统计"菜单项改名为"总览",移至第一位, 默认路由重定向从 /providers 改为 /stats --- frontend/README.md | 6 +++--- frontend/e2e/navigation.spec.ts | 18 +++++++++--------- frontend/e2e/stats.spec.ts | 4 ++-- .../__tests__/components/AppLayout.test.tsx | 2 +- frontend/src/components/AppLayout/index.tsx | 8 ++++---- frontend/src/routes/index.tsx | 2 +- openspec/specs/frontend/spec.md | 12 ++++++------ 7 files changed, 26 insertions(+), 26 deletions(-) diff --git a/frontend/README.md b/frontend/README.md index 2c88d2a..a9fddad 100644 --- a/frontend/README.md +++ b/frontend/README.md @@ -1,6 +1,6 @@ # Nex Frontend -AI 网关管理前端,提供供应商配置和用量统计界面。 +AI 网关管理前端,提供供应商配置和总览界面。 ## 技术栈 @@ -97,7 +97,7 @@ frontend/ │ │ └── useVersion.ts │ ├── pages/ │ │ ├── Providers/ # 供应商管理(含内嵌模型管理) -│ │ ├── Stats/ # 用量统计 +│ │ ├── Stats/ # 总览 │ │ ├── Settings/ # 设置(开发中) │ │ ├── About/ # 关于页面(品牌与版本信息) │ │ └── NotFound.tsx @@ -199,7 +199,7 @@ bun run test:e2e - **统一模型 ID**:显示格式为 `provider_id/model_name`,用于跨协议模型识别,支持一键复制 - **UUID 自动生成**:创建模型时后端自动生成 UUID,无需手动输入 ID -### 用量统计 +### 总览 - 查看统计数据 - 按供应商筛选 diff --git a/frontend/e2e/navigation.spec.ts b/frontend/e2e/navigation.spec.ts index e49107f..cce0732 100644 --- a/frontend/e2e/navigation.spec.ts +++ b/frontend/e2e/navigation.spec.ts @@ -18,7 +18,7 @@ test.describe('侧边栏', () => { test('应显示导航菜单项', async ({ page }) => { const aside = page.locator('aside') await expect(aside.getByText('供应商管理')).toBeVisible() - await expect(aside.getByText('用量统计')).toBeVisible() + await expect(aside.getByText('总览')).toBeVisible() }) }) @@ -28,14 +28,14 @@ test.describe('页面导航', () => { await expect(page.getByRole('heading', { name: '供应商管理' })).toBeVisible() }) - test('应能切换到用量统计', async ({ page }) => { - await page.locator('aside').getByText('用量统计').click() - await expect(page.getByRole('heading', { name: '用量统计' })).toBeVisible() + test('应能切换到总览', async ({ page }) => { + await page.locator('aside').getByText('总览').click() + await expect(page.getByRole('heading', { name: '总览' })).toBeVisible() }) test('应能切换回供应商管理', async ({ page }) => { - await page.locator('aside').getByText('用量统计').click() - await expect(page.getByRole('heading', { name: '用量统计' })).toBeVisible() + await page.locator('aside').getByText('总览').click() + await expect(page.getByRole('heading', { name: '总览' })).toBeVisible() await page.locator('aside').getByText('供应商管理').click() await expect(page.getByRole('heading', { name: '供应商管理' })).toBeVisible() @@ -51,10 +51,10 @@ test.describe('页面导航', () => { }) test('应在刷新后保持当前页面', async ({ page }) => { - await page.locator('aside').getByText('用量统计').click() - await expect(page.getByRole('heading', { name: '用量统计' })).toBeVisible() + await page.locator('aside').getByText('总览').click() + await expect(page.getByRole('heading', { name: '总览' })).toBeVisible() await page.reload() - await expect(page.getByRole('heading', { name: '用量统计' })).toBeVisible() + await expect(page.getByRole('heading', { name: '总览' })).toBeVisible() }) }) diff --git a/frontend/e2e/stats.spec.ts b/frontend/e2e/stats.spec.ts index 45a58aa..c33abc9 100644 --- a/frontend/e2e/stats.spec.ts +++ b/frontend/e2e/stats.spec.ts @@ -41,7 +41,7 @@ test.describe('统计概览', () => { test.beforeEach(async ({ page }) => { await page.goto('/stats') - await expect(page.getByRole('heading', { name: '用量统计' })).toBeVisible() + await expect(page.getByRole('heading', { name: '总览' })).toBeVisible() }) test('应显示正确的总请求量', async ({ page }) => { @@ -99,7 +99,7 @@ test.describe('统计筛选', () => { test.beforeEach(async ({ page }) => { await page.goto('/stats') - await expect(page.getByRole('heading', { name: '用量统计' })).toBeVisible() + await expect(page.getByRole('heading', { name: '总览' })).toBeVisible() }) test('按供应商筛选', async ({ page }) => { diff --git a/frontend/src/__tests__/components/AppLayout.test.tsx b/frontend/src/__tests__/components/AppLayout.test.tsx index b70e42e..90f82e5 100644 --- a/frontend/src/__tests__/components/AppLayout.test.tsx +++ b/frontend/src/__tests__/components/AppLayout.test.tsx @@ -31,7 +31,7 @@ describe('AppLayout', () => { renderWithRouter() expect(screen.getAllByText('供应商管理').length).toBeGreaterThan(0) - expect(screen.getAllByText('用量统计').length).toBeGreaterThan(0) + expect(screen.getAllByText('总览').length).toBeGreaterThan(0) }) it('renders settings menu item', () => { diff --git a/frontend/src/components/AppLayout/index.tsx b/frontend/src/components/AppLayout/index.tsx index 185f69a..7fd64f4 100644 --- a/frontend/src/components/AppLayout/index.tsx +++ b/frontend/src/components/AppLayout/index.tsx @@ -20,7 +20,7 @@ export function AppLayout() { const getPageTitle = () => { if (location.pathname === '/providers') return '供应商管理' - if (location.pathname === '/stats') return '用量统计' + if (location.pathname === '/stats') return '总览' if (location.pathname === '/settings') return '设置' if (location.pathname === '/about') return '关于' return APP_NAME @@ -73,12 +73,12 @@ export function AppLayout() { } style={{ height: '100%' }} > + }> + 总览 + }> 供应商管理 - }> - 用量统计 - }> 设置 diff --git a/frontend/src/routes/index.tsx b/frontend/src/routes/index.tsx index 5ae32df..1dd24b3 100644 --- a/frontend/src/routes/index.tsx +++ b/frontend/src/routes/index.tsx @@ -14,7 +14,7 @@ export function AppRoutes() { }> }> - } /> + } /> } /> } /> } /> diff --git a/openspec/specs/frontend/spec.md b/openspec/specs/frontend/spec.md index 159f195..0bd3453 100644 --- a/openspec/specs/frontend/spec.md +++ b/openspec/specs/frontend/spec.md @@ -2,7 +2,7 @@ ## Purpose -TBD - 提供供应商、模型配置和用量统计的前端管理界面 +TBD - 提供供应商、模型配置和总览的前端管理界面 ## Requirements @@ -489,7 +489,7 @@ TBD - 提供供应商、模型配置和用量统计的前端管理界面 - **THEN** 侧边栏顶部 SHALL 显示统一应用图标和应用名称 `Nex` - **THEN** 侧边栏 SHALL NOT 显示旧品牌文字 `AI Gateway` 作为应用名称 - **THEN** 侧边栏 SHALL 包含导航菜单 -- **THEN** 导航菜单项 SHALL 包含:供应商管理(ServerIcon 图标)、用量统计(ChartLineIcon 图标)、设置(SettingIcon 图标)、关于(InfoCircleIcon 图标) +- **THEN** 导航菜单项 SHALL 按以下顺序包含:总览(ChartLineIcon 图标)、供应商管理(ServerIcon 图标)、设置(SettingIcon 图标)、关于(InfoCircleIcon 图标) #### Scenario: 侧边栏折叠品牌显示 @@ -502,7 +502,7 @@ TBD - 提供供应商、模型配置和用量统计的前端管理界面 - **WHEN** 用户点击导航中的"供应商管理" - **THEN** 前端 SHALL 导航到 `/providers` 并高亮当前菜单项 -- **WHEN** 用户点击导航中的"用量统计" +- **WHEN** 用户点击导航中的"总览" - **THEN** 前端 SHALL 导航到 `/stats` 并高亮当前菜单项 - **WHEN** 用户点击导航中的"设置" - **THEN** 前端 SHALL 导航到 `/settings` 并高亮当前菜单项 @@ -518,10 +518,10 @@ TBD - 提供供应商、模型配置和用量统计的前端管理界面 - **WHEN** 应用启动 - **THEN** 前端 SHALL 使用 React Router v7 Library 模式(BrowserRouter) - **THEN** `/providers` 路径 SHALL 显示供应商管理页面 -- **THEN** `/stats` 路径 SHALL 显示用量统计页面 +- **THEN** `/stats` 路径 SHALL 显示总览页面 - **THEN** `/settings` 路径 SHALL 显示设置页面 - **THEN** `/about` 路径 SHALL 显示关于页面 -- **THEN** `/` 路径 SHALL 重定向到 `/providers` +- **THEN** `/` 路径 SHALL 重定向到 `/stats` - **THEN** 不存在的路径 SHALL 显示 404 页面 #### Scenario: 路由级懒加载 @@ -535,7 +535,7 @@ TBD - 提供供应商、模型配置和用量统计的前端管理界面 - **WHEN** 用户点击导航中的"供应商管理" - **THEN** 前端 SHALL 导航到 `/providers` 并高亮当前菜单项 -- **WHEN** 用户点击导航中的"用量统计" +- **WHEN** 用户点击导航中的"总览" - **THEN** 前端 SHALL 导航到 `/stats` 并高亮当前菜单项 #### Scenario: URL 同步