From 204c5d981632d085fa6f771e8975b751cacbb3a4 Mon Sep 17 00:00:00 2001 From: linshen <32978552+linshenkx@users.noreply.github.com> Date: Tue, 13 Jan 2026 21:17:00 +0800 Subject: [PATCH] =?UTF-8?q?feat(ui):=20=E6=8F=90=E5=8D=87=E5=8F=AF?= =?UTF-8?q?=E8=AE=BF=E9=97=AE=E6=80=A7=E5=B9=B6=E7=A8=B3=E5=AE=9A=20Pro=20?= =?UTF-8?q?Multi=20=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 提升 UI 组件可访问性与导航交互一致性\n- 稳定 Pro Multi 消息优化流程,降低 E2E flake --- .../prompt/service.integration.test.ts | 3 +- packages/ui/env.d.ts | 7 +- .../ui/src/components/FavoriteManager.vue | 14 +- .../src/components/FunctionModeSelector.vue | 5 +- .../components/OptimizationModeSelector.vue | 6 +- packages/ui/src/components/OutputDisplay.vue | 7 + .../ui/src/components/OutputDisplayCore.vue | 7 + packages/ui/src/components/PromptPanel.vue | 6 + .../src/components/app-layout/AppCoreNav.vue | 2 +- .../app-layout/PromptOptimizerApp.vue | 2 +- .../basic-mode/BasicSystemWorkspace.vue | 1 + .../basic-mode/BasicUserWorkspace.vue | 1 + .../context-mode/ContextSystemWorkspace.vue | 80 +++++--- .../context-mode/ContextUserWorkspace.vue | 1 + .../context-mode/ConversationManager.vue | 43 +++-- .../image-mode/ImageImage2ImageWorkspace.vue | 4 +- .../image-mode/ImageModeSelector.vue | 2 + .../image-mode/ImageText2ImageWorkspace.vue | 4 +- .../prompt/useConversationOptimization.ts | 11 +- .../workspaces/useBasicWorkspaceLogic.ts | 24 +-- .../workspaces/useWorkspaceModelSelection.ts | 21 ++- .../session/useProMultiMessageSession.ts | 32 ++-- tests/e2e/category-management.spec.ts | 72 ++----- tests/e2e/favorite-management.spec.ts | 65 +++---- tests/e2e/fixtures.ts | 38 +--- .../优化提示词并生成优化结果.json | 53 ++++++ .../优化提示词并生成优化结果.json | 53 ++++++ .../自动选择最新消息并优化-生成优化结果.json | 53 ++++++ .../优化带变量的提示词并生成优化结果.json | 53 ++++++ tests/e2e/helpers/common.ts | 48 +++-- tests/e2e/helpers/optimize.ts | 177 ++++++++++++++++++ tests/e2e/helpers/vcr.ts | 174 ++++++++++++++--- tests/e2e/optimize/basic-system.spec.ts | 28 +++ tests/e2e/optimize/basic-user.spec.ts | 28 +++ tests/e2e/optimize/pro-multi.spec.ts | 33 ++++ tests/e2e/optimize/pro-variable.spec.ts | 29 +++ .../model-default-and-cross-mode.spec.ts | 48 +++-- .../template-default-and-cross-mode.spec.ts | 33 ++-- tests/e2e/tag-management.spec.ts | 69 +++---- .../workflows/route-initialization.spec.ts | 2 +- 40 files changed, 1000 insertions(+), 339 deletions(-) create mode 100644 tests/e2e/fixtures/vcr/optimize-basic-system-spec-ts/优化提示词并生成优化结果.json create mode 100644 tests/e2e/fixtures/vcr/optimize-basic-user-spec-ts/优化提示词并生成优化结果.json create mode 100644 tests/e2e/fixtures/vcr/optimize-pro-multi-spec-ts/自动选择最新消息并优化-生成优化结果.json create mode 100644 tests/e2e/fixtures/vcr/optimize-pro-variable-spec-ts/优化带变量的提示词并生成优化结果.json create mode 100644 tests/e2e/helpers/optimize.ts create mode 100644 tests/e2e/optimize/basic-system.spec.ts create mode 100644 tests/e2e/optimize/basic-user.spec.ts create mode 100644 tests/e2e/optimize/pro-multi.spec.ts create mode 100644 tests/e2e/optimize/pro-variable.spec.ts diff --git a/packages/core/tests/integration/prompt/service.integration.test.ts b/packages/core/tests/integration/prompt/service.integration.test.ts index 9c2dd9ff..ba9e1760 100644 --- a/packages/core/tests/integration/prompt/service.integration.test.ts +++ b/packages/core/tests/integration/prompt/service.integration.test.ts @@ -18,9 +18,10 @@ import { TextAdapterRegistry } from '../../../src/services/llm/adapters/registry */ describe('PromptService Integration Tests', () => { const hasGeminiKey = !!process.env.VITE_GEMINI_API_KEY; - const DELAY_BETWEEN_TESTS = 6000; // 1分钟延迟避免速率限制 + const DELAY_BETWEEN_TESTS = 60000; // 1分钟延迟避免速率限制 const TEST_TIMEOUT = 120000; // 2分钟超时 + let promptService: PromptService; let modelManager: ModelManager; let llmService: any; diff --git a/packages/ui/env.d.ts b/packages/ui/env.d.ts index 128cde31..8ca741af 100644 --- a/packages/ui/env.d.ts +++ b/packages/ui/env.d.ts @@ -9,5 +9,10 @@ declare module '*.vue' { // Vite 已经通过 /// 提供了内置的环境变量类型 +// E2E: 注入到 window 的测试辅助变量 +interface Window { + __TEST_DB_NAME__?: string +} + // 引入 Electron 类型定义 -/// \ No newline at end of file +/// diff --git a/packages/ui/src/components/FavoriteManager.vue b/packages/ui/src/components/FavoriteManager.vue index 2542ed2f..b959038f 100644 --- a/packages/ui/src/components/FavoriteManager.vue +++ b/packages/ui/src/components/FavoriteManager.vue @@ -58,7 +58,7 @@ :options="actionMenuOptions" @select="handleActionMenuSelect" > - + @@ -475,12 +475,14 @@ const actionMenuOptions = computed(() => [ { label: t('favorites.manager.actions.manageTags'), key: 'manageTags', - icon: () => h(NIcon, null, { default: () => h(Tags) }) + icon: () => h(NIcon, null, { default: () => h(Tags) }), + props: { 'data-testid': 'favorites-manager-action-manage-tags' } }, { label: t('favorites.manager.actions.manageCategories'), key: 'manageCategories', - icon: () => h(NIcon, null, { default: () => h(Folder) }) + icon: () => h(NIcon, null, { default: () => h(Folder) }), + props: { 'data-testid': 'favorites-manager-action-manage-categories' } }, { type: 'divider' @@ -488,7 +490,8 @@ const actionMenuOptions = computed(() => [ { label: t('favorites.manager.actions.export'), key: 'export', - icon: () => h(NIcon, null, { default: () => h(Download) }) + icon: () => h(NIcon, null, { default: () => h(Download) }), + props: { 'data-testid': 'favorites-manager-action-export' } }, { type: 'divider' @@ -496,7 +499,8 @@ const actionMenuOptions = computed(() => [ { label: t('favorites.manager.actions.clear'), key: 'clear', - icon: () => h(NIcon, null, { default: () => h(Trash) }) + icon: () => h(NIcon, null, { default: () => h(Trash) }), + props: { 'data-testid': 'favorites-manager-action-clear' } } ]); diff --git a/packages/ui/src/components/FunctionModeSelector.vue b/packages/ui/src/components/FunctionModeSelector.vue index 800bfa9e..41f4bb08 100644 --- a/packages/ui/src/components/FunctionModeSelector.vue +++ b/packages/ui/src/components/FunctionModeSelector.vue @@ -1,24 +1,27 @@