[WS-90] 修复模型选择与流程状态 - #26
Merged
Merged
Conversation
…elector, graph stages Implements the Workflow Desk redesign per ui-designer/ui-spec.md and ui-designer/design/implementation-plan.md (frontend-only; no backend or OpenAPI contract changes). - Tokens + typography: remap globals.css :root + tailwind.config.js to the Workflow Desk palette (ink #0a0d12, surface #171f2b, line #304154, mint #9bffbe action, sky-blue #8acbff flow) and add Instrument Serif / DM Mono / Noto Sans SC fonts. Mint/blue accent buttons now use dark ink text for correct contrast across all routes. - Shell: rebuild AppNavbar as a fixed desktop research rail (248px) + slim top status bar + mobile drawer; reserve rail space via desktop body padding. Admin-only gating preserved (AppNavbar.test.tsx passes). - Privacy boundary (WS-13/story-001): new ModelSelector exposes model display names only — never provider, endpoint, key state, or system-default provenance. AnalysisConfigForm step 5 now drives selection through it and drops the provider dropdown, provenance bars and inline API-key input; provider/backend_url/key are still resolved silently for the payload. ModelSelector.test.tsx proves model-name-only exposure + no-model recovery. - Graph fidelity: new lib/workflow-stages.ts encodes the real GraphSetup 5-band / 12-node model; AnalysisProgress rebuilt to 5 bands (Analyst Team → Bull/Bear debate → Research Manager → Trader → Risky/Safe/Neutral → Risk Judge) with Risk Judge split into its own terminal band. workflow-stages .test.ts asserts graph fidelity. - State primitives: add EmptyState + ErrorState (PageLoading already existed). Verification (web/frontend): npm run typecheck ✓, npm run test:run 42/42 ✓, npm run build ✓ (18 routes prerendered). npm run lint: no new errors (3 pre-existing errors in untouched files; next.config ignores eslint during build). Co-Authored-By: Claude <noreply@anthropic.com> Co-authored-by: multica-agent <github@multica.ai>
Co-authored-by: multica-agent <github@multica.ai>
There was a problem hiding this comment.
Pull request overview
This PR updates the frontend “Workflow Desk” experience by (1) reskinning the UI (theme + typography), (2) introducing reusable loading/empty/error primitives, and (3) aligning the analysis launch + progress surfaces with the backend’s workflow semantics (model selection privacy boundary, Risk Judge terminal band, executor phase ID separation).
Changes:
- Introduce “Workflow Desk” design tokens (Tailwind + CSS variables), typography, and navigation rail layout.
- Add canonical workflow stage model + tests, and update AnalysisProgress to keep Risk Judge as a permanent terminal band while isolating the optional executor phase.
- Add reusable
PageLoading/EmptyState/ErrorStatecomponents and adopt them across route and data-loading surfaces; add model-onlyModelSelector+ tests and wire into the analysis launch form.
Reviewed changes
Copilot reviewed 43 out of 43 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| web/frontend/tailwind.config.js | Update theme colors, spacing, fonts, shadows, and animations for Workflow Desk. |
| web/frontend/src/lib/workflow-stages.ts | Add canonical workflow stage/band model aligned to backend agent codes. |
| web/frontend/src/lib/workflow-stages.test.ts | Add tests asserting workflow stage fidelity and routing. |
| web/frontend/src/lib/types.ts | Extend system-default provider summary with shallow/deep model fields. |
| web/frontend/src/components/ui/ErrorState.tsx | Add reusable recoverable error UI primitive with optional retry. |
| web/frontend/src/components/ui/EmptyState.tsx | Add reusable empty-state UI primitive with optional action. |
| web/frontend/src/components/profile/ProviderFormDrawer.tsx | Adjust button text color to match new accent palette. |
| web/frontend/src/components/profile/LocalKeyField.tsx | Adjust button text color to match new accent palette. |
| web/frontend/src/components/profile/AISettingsCard.tsx | Adjust “管理” CTA text color to match new accent palette. |
| web/frontend/src/components/conversation/SessionSidebar.tsx | Update CTA text color for new gradient buttons. |
| web/frontend/src/components/conversation/MessageBubble.tsx | Update user bubble/avatar text color for new gradient buttons. |
| web/frontend/src/components/conversation/LoginNudge.tsx | Update login CTA text color for new gradient buttons. |
| web/frontend/src/components/conversation/Composer.tsx | Update send button text color for new gradient buttons. |
| web/frontend/src/components/common/AppNavbar.tsx | Redesign navigation into desktop rail + top status bar + mobile drawer. |
| web/frontend/src/components/auth/LoginForm.tsx | Update segmented control + submit button text color for new theme. |
| web/frontend/src/components/analysis/ModelSelector.tsx | Add model-only selector enforcing privacy boundary (labels only). |
| web/frontend/src/components/analysis/ModelSelector.test.tsx | Add tests ensuring model-only UI does not leak provider/key/endpoint. |
| web/frontend/src/components/analysis/AnalysisResults.tsx | Replace ad-hoc loading/error UI with PageLoading + ErrorState. |
| web/frontend/src/components/analysis/AnalysisProgress.tsx | Make Risk Judge a permanent terminal band; isolate optional executor phase ID. |
| web/frontend/src/components/analysis/AnalysisProgress.test.tsx | Add test ensuring Risk Judge band persists when executor is disabled. |
| web/frontend/src/components/analysis/AnalysisHistory.tsx | Replace ad-hoc loading/empty/error UI with shared primitives. |
| web/frontend/src/components/analysis/AnalysisConfigForm.tsx | Wire model-only ModelSelector into launch form; remove launch-surface key entry messaging. |
| web/frontend/src/components/admin/system-default-provider/SystemDefaultForm.tsx | Replace ad-hoc loading/error UI with shared primitives; update button text color. |
| web/frontend/src/components/admin/ResponsiveUserCard.tsx | Update avatar gradient text color for non-admin users. |
| web/frontend/src/components/admin/llm-config/ProviderForm.tsx | Update submit button text color for new theme. |
| web/frontend/src/components/admin/llm-config/ModelForm.tsx | Update submit button text color for new theme. |
| web/frontend/src/app/scheduled-tasks/page.tsx | Adopt shared loading/empty/error UI and update pagination active styles. |
| web/frontend/src/app/profile/page.tsx | Use PageLoading for auth loading; update CTA button text colors. |
| web/frontend/src/app/profile/ai-settings/page.tsx | Add loading/error states via shared primitives; update CTA styles. |
| web/frontend/src/app/page.tsx | Replace auth-loading spinner with PageLoading. |
| web/frontend/src/app/not-found.tsx | Use EmptyState for migrated 404 page. |
| web/frontend/src/app/loading.tsx | Add global App Router route-level loading UI using PageLoading. |
| web/frontend/src/app/layout.tsx | Update metadata, theme-color, fonts, and apply font-sans on body. |
| web/frontend/src/app/history/progress/page.tsx | Replace ad-hoc loading/error UI with shared primitives + Suspense fallback. |
| web/frontend/src/app/history/page.tsx | Replace auth-loading spinner with PageLoading. |
| web/frontend/src/app/history/detail/page.tsx | Replace ad-hoc loading/error UI with shared primitives + Suspense fallback. |
| web/frontend/src/app/globals.css | Update CSS variables + body font + focus-visible styling + reserve rail padding on lg+. |
| web/frontend/src/app/error.tsx | Add global route-level error boundary using ErrorState. |
| web/frontend/src/app/auth/page.tsx | Replace redirect spinner with PageLoading. |
| web/frontend/src/app/analysis/page.tsx | Replace ad-hoc loading/error UI with shared primitives + Suspense fallback. |
| web/frontend/src/app/admin/users/page.tsx | Adopt shared loading/empty/error UI primitives. |
| web/frontend/src/app/admin/system-default-provider/page.tsx | Replace auth-loading spinner with PageLoading. |
| web/frontend/src/app/admin/llm-config/page.tsx | Add loading/error states for providers/models and update CTA button styles. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
390
to
+393
| // 查找对应的阶段 | ||
| const executorPhaseIndex = newPhases.findIndex( | ||
| (phase) => phase.id === TRADING_EXECUTOR_PHASE_ID, | ||
| ); |
Comment on lines
+107
to
+111
| const handleChange = (e: React.ChangeEvent<HTMLSelectElement>) => { | ||
| const label = e.target.value; | ||
| const next = options.find((o) => o.label === label) || null; | ||
| onChange(next); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Validation
npm run test:run— passed.npm run typecheck— passed.npm run build— attempted repeatedly, but this runtime terminated Next.js during compilation with exhausted Swap and no generatedBUILD_ID; no source diagnostic was emitted.Scope
Frontend only. No backend or OpenAPI changes.