fix: defaut ui triage (#4802)

* fix: theme-aware payment paths, auto-group validation, route guards, perf group filtering

- Add common.ThemeAwarePath to generate correct redirect URLs based on
  active theme (default vs classic), replacing hardcoded /console/* paths
  in 7 controllers and service/quota.go (#4765)
- Validate auto-group availability against getUserGroups before defaulting
  form values; playground falls back to 'default' group when 'auto' is
  unavailable (#4796, #4799)
- Enforce HeaderNavModules settings in rankings route (frontend + backend
  API) and SidebarModulesAdmin in playground route to block direct URL
  access when features are disabled (#4704, #4512)
- Filter perf_metrics API response to only include currently configured
  groups, hiding stale data from deleted groups (#4790)
- Preserve query params (pay=success/fail) in /console/topup → /wallet
  frontend redirect

* fix: update hero section text and localization strings for clarity
This commit is contained in:
Calcium-Ion
2026-05-12 16:47:02 +08:00
committed by GitHub
parent a720064d91
commit 469d3747af
27 changed files with 261 additions and 71 deletions
+3 -2
View File
@@ -39,8 +39,9 @@ export const API_ENDPOINTS = {
USER_GROUPS: '/api/user/self/groups',
} as const
// Default group
export const DEFAULT_GROUP = 'auto' as const
// Default group — uses 'default' as the safe fallback; auto-group is
// only selected when the backend confirms it is available for the user.
export const DEFAULT_GROUP = 'default' as const
// Default configuration
export const DEFAULT_CONFIG: PlaygroundConfig = {
+9 -16
View File
@@ -21,7 +21,6 @@ import { useQuery } from '@tanstack/react-query'
import { getUserModels, getUserGroups } from './api'
import { PlaygroundChat } from './components/playground-chat'
import { PlaygroundInput } from './components/playground-input'
import { DEFAULT_GROUP } from './constants'
import { usePlaygroundState, useChatHandler } from './hooks'
import { createUserMessage, createLoadingAssistantMessage } from './lib'
import type { Message as MessageType } from './types'
@@ -79,22 +78,16 @@ export function Playground() {
useEffect(() => {
if (!groupsData) return
// Add auto group if not present
const hasAutoGroup = groupsData.some((g) => g.value === DEFAULT_GROUP)
const processedGroups = hasAutoGroup
? groupsData
: [
{
value: DEFAULT_GROUP,
label: 'Auto',
ratio: 1,
desc: 'Circuit Breaker',
},
...groupsData,
]
setGroups(groupsData)
setGroups(processedGroups)
}, [groupsData, setGroups])
const hasCurrentGroup = groupsData.some((g) => g.value === config.group)
if (!hasCurrentGroup && groupsData.length > 0) {
const fallback =
groupsData.find((g) => g.value === 'default')?.value ??
groupsData[0].value
updateConfig('group', fallback)
}
}, [groupsData, setGroups, config.group, updateConfig])
const handleSendMessage = (text: string) => {
const userMessage = createUserMessage(text)