Skip to content

Operator console stabilization - #5458

Closed
MisakiSATA wants to merge 4 commits into
QuantumNous:mainfrom
MisakiSATA:operator-console-stabilization
Closed

MisakiSATA wants to merge 4 commits into
QuantumNous:mainfrom
MisakiSATA:operator-console-stabilization

Conversation

@MisakiSATA

@MisakiSATA MisakiSATA commented Jun 12, 2026 •

Copy link
Copy Markdown

⚠️ 提交说明 / PR Notice

Important

  • 请提供人工撰写的简洁摘要,避免直接粘贴未经整理的 AI 输出。

📝 变更描述 / Description

(简述:做了什么?为什么这样改能生效?请基于你对代码逻辑的理解来写,避免粘贴未经整理的内容)

🚀 变更类型 / Type of change

  • 🐛 Bug 修复 (Bug fix) - 请关联对应 Issue,避免将设计取舍、理解偏差或预期不一致直接归类为 bug
  • ✨ 新功能 (New feature) - 重大特性建议先通过 Issue 沟通
  • ⚡ 性能优化 / 重构 (Refactor)
  • 📝 文档更新 (Documentation)

🔗 关联任务 / Related Issue

  • Closes # (如有)

✅ 提交前检查项 / Checklist

  • 人工确认: 我已亲自整理并撰写此描述,没有直接粘贴未经处理的 AI 输出。
  • 非重复提交: 我已搜索现有的 Issues 与 PRs,确认不是重复提交。
  • Bug fix 说明: 若此 PR 标记为 Bug fix,我已提交或关联对应 Issue,且不会将设计取舍、预期不一致或理解偏差直接归类为 bug。
  • 变更理解: 我已理解这些更改的工作原理及可能影响。
  • 范围聚焦: 本 PR 未包含任何与当前任务无关的代码改动。
  • 本地验证: 已在本地运行并通过测试或手动验证,维护者可以据此复核结果。
  • 安全合规: 代码中无敏感凭据,且符合项目代码规范。

📸 运行证明 / Proof of Work

(请在此粘贴截图、关键日志或测试报告,以证明变更生效)

Summary by CodeRabbit

  • New Features

    • Added operational metric cards and command strips across dashboard, channels, models, profile, settings, usage logs, users, and wallet pages.
    • Introduced API connection kit displaying base URL and authorization headers.
    • Enhanced Claude request conversion with media and file handling.
  • UI/Style Updates

    • New "Launch UI" styling system with surface, terminal, and operator visual tokens.
    • Redesigned hero section and terminal demo.
    • Updated layouts with improved spacing and visual hierarchy.
  • Bug Fixes

    • Fixed out-of-range indexing in model list responses.
    • Replaced runtime panics with proper error handling across multiple adapters.
    • Improved request timeout handling.
  • Security

    • Restricted CORS to specific origins and headers.
    • Added security headers (X-Content-Type-Options, X-Frame-Options, etc.).
  • Tests

    • Added CORS and security header validation tests.
  • Localization

    • Updated translations for new UI labels across multiple languages.

@coderabbitai

coderabbitai Bot commented Jun 12, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: fda9ee89-e8ce-453b-871c-bee04c88fad8

📥 Commits

Reviewing files that changed from the base of the PR and between 6f41542 and 338bbcf.

📒 Files selected for processing (74)
  • controller/model.go
  • middleware/cors.go
  • middleware/cors_test.go
  • relay/channel/baidu/adaptor.go
  • relay/channel/claude/relay-claude.go
  • relay/channel/cloudflare/adaptor.go
  • relay/channel/cohere/adaptor.go
  • relay/channel/dify/adaptor.go
  • relay/channel/jina/adaptor.go
  • relay/channel/mistral/adaptor.go
  • relay/channel/mokaai/adaptor.go
  • relay/channel/palm/adaptor.go
  • relay/channel/tencent/adaptor.go
  • relay/channel/xunfei/adaptor.go
  • relay/channel/zhipu/adaptor.go
  • web/default/rsbuild.config.ts
  • web/default/src/components/ai-elements/code-block.tsx
  • web/default/src/components/data-state-surface.tsx
  • web/default/src/components/data-table/data-table-page.tsx
  • web/default/src/components/data-table/mobile-card-list.tsx
  • web/default/src/components/data-table/table-empty.tsx
  • web/default/src/components/data-table/table-skeleton.tsx
  • web/default/src/components/data-table/toolbar.tsx
  • web/default/src/components/empty-state.tsx
  • web/default/src/components/error-state.tsx
  • web/default/src/components/layout/components/authenticated-layout.tsx
  • web/default/src/components/layout/components/public-header.tsx
  • web/default/src/components/layout/components/section-page-layout.tsx
  • web/default/src/components/loading-state.tsx
  • web/default/src/components/operational-metric-card.tsx
  • web/default/src/components/ui/table.tsx
  • web/default/src/features/auth/auth-layout.tsx
  • web/default/src/features/auth/sign-in/index.tsx
  • web/default/src/features/auth/sign-up/index.tsx
  • web/default/src/features/channels/components/channels-command-strip.tsx
  • web/default/src/features/channels/index.tsx
  • web/default/src/features/dashboard/components/overview/summary-cards.tsx
  • web/default/src/features/home/api.ts
  • web/default/src/features/home/components/hero-terminal-demo.tsx
  • web/default/src/features/home/components/sections/cta.tsx
  • web/default/src/features/home/components/sections/features.tsx
  • web/default/src/features/home/components/sections/hero.tsx
  • web/default/src/features/home/components/sections/how-it-works.tsx
  • web/default/src/features/home/components/sections/stats.tsx
  • web/default/src/features/home/hooks/use-home-page-content.ts
  • web/default/src/features/keys/components/connection-kit.tsx
  • web/default/src/features/keys/index.tsx
  • web/default/src/features/models/components/models-command-strip.tsx
  • web/default/src/features/models/index.tsx
  • web/default/src/features/pricing/index.tsx
  • web/default/src/features/profile/components/profile-command-strip.tsx
  • web/default/src/features/profile/components/profile-header.tsx
  • web/default/src/features/profile/index.tsx
  • web/default/src/features/system-settings/components/settings-command-strip.tsx
  • web/default/src/features/system-settings/components/settings-page.tsx
  • web/default/src/features/usage-logs/components/usage-logs-command-strip.tsx
  • web/default/src/features/usage-logs/index.tsx
  • web/default/src/features/users/components/users-command-strip.tsx
  • web/default/src/features/users/index.tsx
  • web/default/src/features/wallet/components/wallet-command-strip.tsx
  • web/default/src/features/wallet/index.tsx
  • web/default/src/hooks/use-system-config.ts
  • web/default/src/i18n/locales/_reports/_sync-report.json
  • web/default/src/i18n/locales/_reports/ja.untranslated.json
  • web/default/src/i18n/locales/_reports/ru.untranslated.json
  • web/default/src/i18n/locales/_reports/zh.untranslated.json
  • web/default/src/i18n/locales/en.json
  • web/default/src/i18n/locales/fr.json
  • web/default/src/i18n/locales/ja.json
  • web/default/src/i18n/locales/ru.json
  • web/default/src/i18n/locales/vi.json
  • web/default/src/i18n/locales/zh.json
  • web/default/src/styles/index.css
  • web/default/src/styles/theme.css

Walkthrough

This PR introduces a cohesive visual and functional redesign across the platform. Backend changes harden error handling by eliminating panics and improving CORS security. Frontend changes introduce reusable state and metrics components, refactor multiple feature pages with consistent command strip displays and descriptions, comprehensively redesign the home page, and add new CSS utilities and theme tokens supporting the updated visual language across all locales.

Changes

Backend Error Handling & CORS Configuration

Layer / File(s) Summary
Model listing and CORS security
controller/model.go, middleware/cors.go, middleware/cors_test.go
ListModels now handles group lookup failures conditionally based on model-limit mode; Anthropic pagination safely handles empty model lists. CORS() restricts origins to non-empty values and narrows headers allowlist; PoweredBy() adds security headers (X-Content-Type-Options, X-Frame-Options, Referrer-Policy, Permissions-Policy). Tests verify correct CORS credentialing and security header presence.
Relay adapter error handling
relay/channel/baidu/adaptor.go, relay/channel/cloudflare/adaptor.go, relay/channel/cohere/adaptor.go, relay/channel/dify/adaptor.go, relay/channel/jina/adaptor.go, relay/channel/mistral/adaptor.go, relay/channel/mokaai/adaptor.go, relay/channel/palm/adaptor.go, relay/channel/tencent/adaptor.go, relay/channel/xunfei/adaptor.go, relay/channel/zhipu/adaptor.go
Multiple unimplemented converter methods (ConvertGeminiRequest, ConvertClaudeRequest) systematically replace panic("implement me") with errors.New("not implemented") to prevent runtime crashes.
Claude media conversion enhancement
relay/channel/claude/relay-claude.go
New helpers infer MIME types from OpenAI file data URIs or extensions and construct Claude media from OpenAI images/files. Files distinguish PDFs as "document" media and decode base64 text into UTF-8-validated "text" media. Image handling converts to Claude "image" media only when MIME type is image/*; media parsing switch uses dto.ContentType* constants.

Frontend Core Components and Refactoring

Layer / File(s) Summary
DataStateSurface and variant state handling
web/default/src/components/data-state-surface.tsx
New component supporting empty/error/loading/permission/search-empty/offline variants with icon/title/description defaults, retry buttons, and primary/secondary actions. Accessibility attributes (role, aria-busy, aria-live) and responsive styling support empty, bordered, and compact modes.
OperationalMetricCard with sparklines
web/default/src/components/operational-metric-card.tsx
New card component rendering metrics with label, value, unit, optional icons, descriptions, actions, and dual sparkline variants. Bars variant scales heights 0–100% with 8% minimum; line variant generates SVG paths with per-instance gradients.
State refactoring to DataStateSurface
web/default/src/components/empty-state.tsx, web/default/src/components/error-state.tsx, web/default/src/components/loading-state.tsx, web/default/src/components/data-table/table-empty.tsx, web/default/src/components/data-table/mobile-card-list.tsx, web/default/src/components/data-table/table-skeleton.tsx, web/default/src/components/data-table/toolbar.tsx
EmptyState, ErrorState, and LoadingState migrate to use DataStateSurface with updated styling and conditional rendering. Data table components (TableEmpty, MobileCardList, TableSkeleton) adopt surface-glass and interactive-lift styling; skeletons marked with aria-hidden.
Table UI component updates
web/default/src/components/ui/table.tsx
TableHeader, TableRow, and TableHead styling updated with muted backgrounds, hover/selected states, border styling, and uppercase typography.
Data table page and layout updates
web/default/src/components/data-table/data-table-page.tsx
DataTablePage spacing classes adjusted; desktop table container applies surface-console and shadow-none styling.
Core layout component updates
web/default/src/components/layout/components/section-page-layout.tsx, web/default/src/components/layout/components/authenticated-layout.tsx, web/default/src/components/layout/components/public-header.tsx
SectionPageLayout adds optional density prop ('compact' | 'comfortable') and Description slot component. AuthenticatedLayout adds operator-backplane class. PublicHeader scrolled state switches to surface-terminal styling with adjusted width/height/shadow.
System config and build configuration
web/default/rsbuild.config.ts, web/default/src/hooks/use-system-config.ts
Dev server port derived from VITE_PORT/PORT env with 5173 fallback. System config enforces STATUS_REQUEST_TIMEOUT_MS via AbortController; logo preload failure resets to DEFAULT_LOGO with early return.
Minor type and import cleanup
web/default/src/components/ai-elements/code-block.tsx, web/default/src/features/home/api.ts
Removed unused hast Element type import. Home page API request adds skipErrorHandler: true, timeout: 1500 options.

Feature Pages with Command Strips and Descriptions

Layer / File(s) Summary
Command strip components across features
web/default/src/features/channels/components/channels-command-strip.tsx, web/default/src/features/models/components/models-command-strip.tsx, web/default/src/features/profile/components/profile-command-strip.tsx, web/default/src/features/system-settings/components/settings-command-strip.tsx, web/default/src/features/usage-logs/components/usage-logs-command-strip.tsx, web/default/src/features/users/components/users-command-strip.tsx, web/default/src/features/wallet/components/wallet-command-strip.tsx
New command strip components render 3–4 OperationalMetricCard entries per page with localized text and icons. Models and usage-logs cards conditionally display values based on activeSection/logCategory; profile cards map quota/status/checkin state to tone variants.
Dashboard summary cards and overview
web/default/src/features/dashboard/components/overview/summary-cards.tsx
Summary cards refactored from StatCard to OperationalMetricCard. Sparkline keys reduced to usage/requests only (balance removed). New "Command center" label and operator-styled rail structure added to metrics grid.
Feature page command strip integrations
web/default/src/features/channels/index.tsx, web/default/src/features/models/index.tsx, web/default/src/features/profile/index.tsx, web/default/src/features/system-settings/components/settings-page.tsx, web/default/src/features/usage-logs/index.tsx, web/default/src/features/users/index.tsx, web/default/src/features/wallet/index.tsx
Channels, models, profile, settings, usage-logs, users, and wallet pages render command strip components within updated layouts. SectionPageLayout.Description added below page titles; content wrapped in space-y-* containers.
Auth pages and API keys features
web/default/src/features/auth/auth-layout.tsx, web/default/src/features/auth/sign-in/index.tsx, web/default/src/features/auth/sign-up/index.tsx, web/default/src/features/keys/components/connection-kit.tsx, web/default/src/features/keys/index.tsx
AuthLayout restructured with marketing mesh/grid backgrounds and conditional skeleton rendering. SignIn/SignUp pages add descriptive paragraphs. New ConnectionKit component displays Base URL and Bearer header with copy buttons plus API key creation and preset studio links.
Pricing page header label
web/default/src/features/pricing/index.tsx
New operator-metric-label element added above pricing page title.

Home Page Redesign and Components

Layer / File(s) Summary
Hero terminal demo timing and styling
web/default/src/features/home/components/hero-terminal-demo.tsx
Timeout-based transition management replaces cycle interval. Tab styling updated with active/inactive states; endpoint rendering uses terminal colors; footer metrics container adds translucent background; response panel styled with border-white/8 and lighter bg.
Hero section redesign and messaging
web/default/src/features/home/components/sections/hero.tsx
Icon imports expanded. Hero section markup rewritten with operator/mesh backgrounds. Left-column gateway/provider content updated. New metrics grid displays route health, spend drift, latency budget. Supported apps UI simplified to pill-style external links.
Additional home page sections
web/default/src/features/home/components/sections/cta.tsx, web/default/src/features/home/components/sections/features.tsx, web/default/src/features/home/components/sections/how-it-works.tsx, web/default/src/features/home/components/sections/stats.tsx
CTA uses surface-console card with text-gradient-brand heading. Features section Bento grid switches to surface-route/interactive-lift cards. How-it-works refactored to semantic <ol> with <li> steps and sr-only labels. Stats converted to <dl>/<dt>/<dd> structure with aria-labels.
Home page API and content handling
web/default/src/features/home/api.ts, web/default/src/features/home/hooks/use-home-page-content.ts
API request adds timeout configuration and error handler bypass. Content hook fallback logic preserves cached content on backend unavailability instead of emitting error toast.

CSS Theming, Utilities, and Localization

Layer / File(s) Summary
CSS utilities layer and typography
web/default/src/styles/index.css
Base typography optimization adds text-rendering: optimizeLegibility and font feature settings. New utilities layer introduces marketing mesh/grid, surface backgrounds, operator visuals, typography helpers (.operator-metric-label, .operator-number), shadows, and interactive-lift hover effect gated by media query.
CSS theme color and design tokens
web/default/src/styles/theme.css
Light and dark theme custom properties for surfaces (raised/muted/glass/console/route/terminal/selected), borders (subtle/strong), status colors (active/degraded/failed/paused/testing), brand glows/signals/routes/ledgers, and shadows with dark-mode oklch/color-mix values.
i18n locale translations
web/default/src/i18n/locales/en.json, web/default/src/i18n/locales/fr.json, web/default/src/i18n/locales/ja.json, web/default/src/i18n/locales/ru.json, web/default/src/i18n/locales/vi.json, web/default/src/i18n/locales/zh.json
English base and corresponding translations across French, Japanese, Russian, Vietnamese, and Chinese locales for new UI concepts: gateway console, failover graph, gateway live control, latency budget, ledger aware, policy guarded, SLO visible, spend drift, Zyphorix API provider label.
i18n sync reports and untranslated entries
web/default/src/i18n/locales/_reports/_sync-report.json, web/default/src/i18n/locales/_reports/ja.untranslated.json, web/default/src/i18n/locales/_reports/ru.untranslated.json, web/default/src/i18n/locales/_reports/zh.untranslated.json
Sync report untranslated counts incremented for ja/ru/zh; untranslated.json entries added for Zyphorix API across locales.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • QuantumNous/new-api#3505: Updates Claude media handling in relay/channel/claude/relay-claude.go with similar file/image type checking logic.
  • QuantumNous/new-api#1831: Delegates Claude request conversion for Moonshot channel, exercising the updated Claude media conversion logic.
  • QuantumNous/new-api#5405: Also removes unused hast Element type import from web/default/src/components/ai-elements/code-block.tsx.

Suggested reviewers

  • Calcium-Ion
  • creamlike1024

🐰 A garden of metrics grows so bright,
Command strips dance in operator's light,
DataSurfaces render error states with care,
New theme tokens float through the air,
From panics freed, the channels sing their song! 🎨

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch operator-console-stabilization

@MisakiSATA MisakiSATA closed this Jun 12, 2026
@MisakiSATA
MisakiSATA deleted the operator-console-stabilization branch June 12, 2026 11:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant