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:
@@ -19,7 +19,6 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
import { Link } from '@tanstack/react-router'
|
||||
import { ArrowRight } from 'lucide-react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useSystemConfig } from '@/hooks/use-system-config'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { HeroTerminalDemo } from '../hero-terminal-demo'
|
||||
|
||||
@@ -30,7 +29,6 @@ interface HeroProps {
|
||||
|
||||
export function Hero(props: HeroProps) {
|
||||
const { t } = useTranslation()
|
||||
const { systemName } = useSystemConfig()
|
||||
|
||||
return (
|
||||
<section className='relative z-10 flex flex-col items-center overflow-hidden px-6 pt-28 pb-16 md:pt-36 md:pb-24'>
|
||||
@@ -67,10 +65,7 @@ export function Hero(props: HeroProps) {
|
||||
className='landing-animate-fade-up text-muted-foreground/80 mt-5 max-w-lg text-base leading-relaxed opacity-0 md:text-lg'
|
||||
style={{ animationDelay: '80ms' }}
|
||||
>
|
||||
{systemName}{' '}
|
||||
{t(
|
||||
'is an open-source AI API gateway for self-hosted deployments. Connect multiple upstream services, manage models, keys, quotas, logs, and routing policies in one place.'
|
||||
)}
|
||||
{t('Power AI applications, manage digital assets, connect the Future')}
|
||||
</p>
|
||||
<div
|
||||
className='landing-animate-fade-up mt-8 flex items-center gap-3 opacity-0'
|
||||
|
||||
@@ -151,15 +151,7 @@ export function ApiKeysMutateDrawer({
|
||||
ratio: info.ratio,
|
||||
})
|
||||
)
|
||||
|
||||
// Add auto group if configured
|
||||
if (!groups.some((g) => g.value === 'auto')) {
|
||||
groups.unshift({
|
||||
value: 'auto',
|
||||
label: 'auto',
|
||||
desc: t('Auto (Circuit Breaker)'),
|
||||
})
|
||||
}
|
||||
const backendHasAuto = groups.some((g) => g.value === 'auto')
|
||||
|
||||
const form = useForm<ApiKeyFormValues>({
|
||||
resolver: zodResolver(apiKeyFormSchema),
|
||||
@@ -169,17 +161,28 @@ export function ApiKeysMutateDrawer({
|
||||
// Load existing data when updating
|
||||
useEffect(() => {
|
||||
if (open && isUpdate && currentRow) {
|
||||
// For update, fetch fresh data
|
||||
getApiKey(currentRow.id).then((result) => {
|
||||
if (result.success && result.data) {
|
||||
form.reset(transformApiKeyToFormDefaults(result.data))
|
||||
}
|
||||
})
|
||||
} else if (open && !isUpdate) {
|
||||
// For create, reset to defaults
|
||||
form.reset(getApiKeyFormDefaultValues(defaultUseAutoGroup))
|
||||
form.reset(getApiKeyFormDefaultValues(defaultUseAutoGroup && backendHasAuto))
|
||||
}
|
||||
}, [open, isUpdate, currentRow, form, defaultUseAutoGroup])
|
||||
}, [open, isUpdate, currentRow, form, defaultUseAutoGroup, backendHasAuto])
|
||||
|
||||
// Correct group after groups load: if the form value is not in available groups, fall back
|
||||
useEffect(() => {
|
||||
if (groups.length === 0) return
|
||||
const currentGroup = form.getValues('group')
|
||||
if (currentGroup && !groups.some((g) => g.value === currentGroup)) {
|
||||
const fallback = groups.find((g) => g.value === 'default')?.value ?? groups[0]?.value ?? ''
|
||||
form.setValue('group', fallback)
|
||||
if (currentGroup === 'auto') {
|
||||
form.setValue('cross_group_retry', false)
|
||||
}
|
||||
}
|
||||
}, [groups, form])
|
||||
|
||||
const onSubmit = async (data: ApiKeyFormValues) => {
|
||||
setIsSubmitting(true)
|
||||
|
||||
+3
-2
@@ -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
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user