Commit 65f8afe9 by t0ng7u

🐛 fix(system-settings): resolve save detection and number input NaN issues

System settings forms that used flat dotted API keys (e.g.
`performance_setting.monitor_cpu_threshold`) with React Hook Form were
broken: RHF stores dotted paths as nested objects on update, while dirty
checks and submit comparisons still read flat keys from defaults. Users
could edit values but always saw "No changes to save".

Refactor affected sections to use nested Zod schemas and default values
for RHF, with explicit helpers to convert between nested form state and
flat API keys. Track a normalized baseline in refs for accurate change
detection and post-save resets.

Add `safeNumberFieldProps` to prevent native `<input type="number">`
from writing NaN into form state when cleared. NaN caused Zod validation
to fail silently and made the save button appear unresponsive. The
helper ignores non-finite updates so controlled inputs snap back to the
last valid value, matching legacy Semi InputNumber behavior.

Sections refactored for dotted-key handling:
- maintenance/performance-section
- models/grok-settings-card
- auth/passkey-section
- auth/oauth-section
- auth/section-registry (pass attachment_preference raw; normalize in section)

Sections migrated to safeNumberFieldProps:
- maintenance/performance-section
- models/grok-settings-card
- integrations/monitoring-settings-section
- integrations/payment-settings-section
- integrations/creem-product-dialog
- general/pricing-section (USD exchange rate)
- general/system-behavior-section
- content/dashboard-section

Optional numeric fields (e.g. custom currency exchange rate) keep their
existing empty-to-undefined semantics and are intentionally unchanged.
parent 5bc4c748
...@@ -79,7 +79,6 @@ const sizeMap = { ...@@ -79,7 +79,6 @@ const sizeMap = {
lg: 'h-6 gap-1.5 px-2 text-xs leading-none', lg: 'h-6 gap-1.5 px-2 text-xs leading-none',
} as const } as const
export interface StatusBadgeProps extends Omit< export interface StatusBadgeProps extends Omit<
React.HTMLAttributes<HTMLSpanElement>, React.HTMLAttributes<HTMLSpanElement>,
'children' 'children'
......
...@@ -638,14 +638,12 @@ export function useChannelsColumns(): ColumnDef<Channel>[] { ...@@ -638,14 +638,12 @@ export function useChannelsColumns(): ColumnDef<Channel>[] {
<Tooltip> <Tooltip>
<TooltipTrigger <TooltipTrigger
render={ render={
<span className='border-border bg-muted text-primary inline-flex h-5 w-5 items-center justify-center rounded-md border shrink-0' /> <span className='border-border bg-muted text-primary inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-md border' />
} }
> >
<MultiKeyModeIcon className='h-3 w-3' /> <MultiKeyModeIcon className='h-3 w-3' />
</TooltipTrigger> </TooltipTrigger>
<TooltipContent side='top'> <TooltipContent side='top'>{multiKeyTooltip}</TooltipContent>
{multiKeyTooltip}
</TooltipContent>
</Tooltip> </Tooltip>
</TooltipProvider> </TooltipProvider>
)} )}
...@@ -654,7 +652,7 @@ export function useChannelsColumns(): ColumnDef<Channel>[] { ...@@ -654,7 +652,7 @@ export function useChannelsColumns(): ColumnDef<Channel>[] {
size='sm' size='sm'
copyable={false} copyable={false}
showDot={false} showDot={false}
className='pl-1 gap-1' className='gap-1 pl-1'
> >
{icon} {icon}
<span className='truncate'>{typeName}</span> <span className='truncate'>{typeName}</span>
......
...@@ -93,14 +93,8 @@ const AUTH_SECTIONS = [ ...@@ -93,14 +93,8 @@ const AUTH_SECTIONS = [
| 'required' | 'required'
| 'preferred' | 'preferred'
| 'discouraged', | 'discouraged',
'passkey.attachment_preference': (settings[ 'passkey.attachment_preference':
'passkey.attachment_preference' settings['passkey.attachment_preference'],
] === ''
? 'none'
: settings['passkey.attachment_preference']) as
| 'none'
| 'platform'
| 'cross-platform',
}} }}
/> />
), ),
......
...@@ -48,6 +48,7 @@ import { ...@@ -48,6 +48,7 @@ import {
import { SettingsPageFormActions } from '../components/settings-page-context' import { SettingsPageFormActions } from '../components/settings-page-context'
import { SettingsSection } from '../components/settings-section' import { SettingsSection } from '../components/settings-section'
import { useUpdateOption } from '../hooks/use-update-option' import { useUpdateOption } from '../hooks/use-update-option'
import { safeNumberFieldProps } from '../utils/numeric-field'
const dataDashboardSchema = z.object({ const dataDashboardSchema = z.object({
DataExportEnabled: z.boolean(), DataExportEnabled: z.boolean(),
...@@ -132,9 +133,8 @@ export function DashboardSection({ defaultValues }: DashboardSectionProps) { ...@@ -132,9 +133,8 @@ export function DashboardSection({ defaultValues }: DashboardSectionProps) {
min={1} min={1}
max={1440} max={1440}
step={1} step={1}
{...safeNumberFieldProps(field)}
disabled={!isEnabled} disabled={!isEnabled}
value={field.value}
onChange={(e) => field.onChange(e.target.valueAsNumber)}
/> />
</FormControl> </FormControl>
<FormDescription> <FormDescription>
......
...@@ -51,6 +51,7 @@ import { SettingsPageFormActions } from '../components/settings-page-context' ...@@ -51,6 +51,7 @@ import { SettingsPageFormActions } from '../components/settings-page-context'
import { SettingsSection } from '../components/settings-section' import { SettingsSection } from '../components/settings-section'
import { useSettingsForm } from '../hooks/use-settings-form' import { useSettingsForm } from '../hooks/use-settings-form'
import { useUpdateOption } from '../hooks/use-update-option' import { useUpdateOption } from '../hooks/use-update-option'
import { safeNumberFieldProps } from '../utils/numeric-field'
const createPricingSchema = (t: (key: string) => string) => const createPricingSchema = (t: (key: string) => string) =>
z z
...@@ -243,11 +244,7 @@ export function PricingSection({ defaultValues }: PricingSectionProps) { ...@@ -243,11 +244,7 @@ export function PricingSection({ defaultValues }: PricingSectionProps) {
<Input <Input
type='number' type='number'
step='0.01' step='0.01'
value={field.value as number} {...safeNumberFieldProps(field)}
onChange={(e) => field.onChange(e.target.valueAsNumber)}
name={field.name}
onBlur={field.onBlur}
ref={field.ref}
/> />
</FormControl> </FormControl>
<FormDescription> <FormDescription>
......
...@@ -40,6 +40,7 @@ import { SettingsPageFormActions } from '../components/settings-page-context' ...@@ -40,6 +40,7 @@ import { SettingsPageFormActions } from '../components/settings-page-context'
import { SettingsSection } from '../components/settings-section' import { SettingsSection } from '../components/settings-section'
import { useResetForm } from '../hooks/use-reset-form' import { useResetForm } from '../hooks/use-reset-form'
import { useUpdateOption } from '../hooks/use-update-option' import { useUpdateOption } from '../hooks/use-update-option'
import { safeNumberFieldProps } from '../utils/numeric-field'
const behaviorSchema = z.object({ const behaviorSchema = z.object({
RetryTimes: z.coerce.number().min(0).max(10), RetryTimes: z.coerce.number().min(0).max(10),
...@@ -96,11 +97,7 @@ export function SystemBehaviorSection({ ...@@ -96,11 +97,7 @@ export function SystemBehaviorSection({
type='number' type='number'
min='0' min='0'
max='10' max='10'
value={field.value as number} {...safeNumberFieldProps(field)}
onChange={(e) => field.onChange(e.target.valueAsNumber)}
name={field.name}
onBlur={field.onBlur}
ref={field.ref}
/> />
</FormControl> </FormControl>
<FormDescription> <FormDescription>
......
...@@ -49,6 +49,7 @@ import { ...@@ -49,6 +49,7 @@ import {
SelectValue, SelectValue,
} from '@/components/ui/select' } from '@/components/ui/select'
import type { CreemProduct } from '@/features/wallet/types' import type { CreemProduct } from '@/features/wallet/types'
import { safeNumberFieldProps } from '../utils/numeric-field'
const creemProductDialogSchema = z.object({ const creemProductDialogSchema = z.object({
name: z.string().min(1, 'Product name is required'), name: z.string().min(1, 'Product name is required'),
...@@ -216,8 +217,7 @@ export function CreemProductDialog({ ...@@ -216,8 +217,7 @@ export function CreemProductDialog({
step='0.01' step='0.01'
min={0.01} min={0.01}
placeholder='10.00' placeholder='10.00'
{...field} {...safeNumberFieldProps(field)}
onChange={(e) => field.onChange(e.target.valueAsNumber)}
/> />
</FormControl> </FormControl>
<FormMessage /> <FormMessage />
...@@ -237,8 +237,7 @@ export function CreemProductDialog({ ...@@ -237,8 +237,7 @@ export function CreemProductDialog({
type='number' type='number'
min={1} min={1}
placeholder={t('e.g., 500000')} placeholder={t('e.g., 500000')}
{...field} {...safeNumberFieldProps(field)}
onChange={(e) => field.onChange(e.target.valueAsNumber)}
/> />
</FormControl> </FormControl>
<FormDescription> <FormDescription>
......
...@@ -44,6 +44,7 @@ import { SettingsPageFormActions } from '../components/settings-page-context' ...@@ -44,6 +44,7 @@ import { SettingsPageFormActions } from '../components/settings-page-context'
import { SettingsSection } from '../components/settings-section' import { SettingsSection } from '../components/settings-section'
import { useResetForm } from '../hooks/use-reset-form' import { useResetForm } from '../hooks/use-reset-form'
import { useUpdateOption } from '../hooks/use-update-option' import { useUpdateOption } from '../hooks/use-update-option'
import { safeNumberFieldProps } from '../utils/numeric-field'
const numericString = z.string().refine((value) => { const numericString = z.string().refine((value) => {
const trimmed = value.trim() const trimmed = value.trim()
...@@ -289,18 +290,7 @@ export function MonitoringSettingsSection({ ...@@ -289,18 +290,7 @@ export function MonitoringSettingsSection({
type='number' type='number'
min={1} min={1}
step={1} step={1}
value={ {...safeNumberFieldProps(field)}
typeof field.value === 'number' &&
Number.isFinite(field.value)
? field.value
: ''
}
onChange={(event) =>
field.onChange(event.target.valueAsNumber)
}
name={field.name}
onBlur={field.onBlur}
ref={field.ref}
/> />
</FormControl> </FormControl>
<FormDescription> <FormDescription>
......
...@@ -55,6 +55,7 @@ import { ...@@ -55,6 +55,7 @@ import {
import { SettingsPageFormActions } from '../components/settings-page-context' import { SettingsPageFormActions } from '../components/settings-page-context'
import { SettingsSection } from '../components/settings-section' import { SettingsSection } from '../components/settings-section'
import { useUpdateOption } from '../hooks/use-update-option' import { useUpdateOption } from '../hooks/use-update-option'
import { safeNumberFieldProps } from '../utils/numeric-field'
import { AmountDiscountVisualEditor } from './amount-discount-visual-editor' import { AmountDiscountVisualEditor } from './amount-discount-visual-editor'
import { AmountOptionsVisualEditor } from './amount-options-visual-editor' import { AmountOptionsVisualEditor } from './amount-options-visual-editor'
import { CreemProductsVisualEditor } from './creem-products-visual-editor' import { CreemProductsVisualEditor } from './creem-products-visual-editor'
...@@ -876,10 +877,7 @@ export function PaymentSettingsSection({ ...@@ -876,10 +877,7 @@ export function PaymentSettingsSection({
type='number' type='number'
step='0.01' step='0.01'
min={0} min={0}
value={(field.value ?? 0) as number} {...safeNumberFieldProps(field)}
onChange={(event) =>
field.onChange(event.target.valueAsNumber)
}
/> />
</FormControl> </FormControl>
<FormDescription> <FormDescription>
...@@ -903,10 +901,7 @@ export function PaymentSettingsSection({ ...@@ -903,10 +901,7 @@ export function PaymentSettingsSection({
type='number' type='number'
step='0.01' step='0.01'
min={0} min={0}
value={(field.value ?? 0) as number} {...safeNumberFieldProps(field)}
onChange={(event) =>
field.onChange(event.target.valueAsNumber)
}
/> />
</FormControl> </FormControl>
<FormDescription> <FormDescription>
...@@ -1314,10 +1309,7 @@ export function PaymentSettingsSection({ ...@@ -1314,10 +1309,7 @@ export function PaymentSettingsSection({
type='number' type='number'
step='0.01' step='0.01'
min={0} min={0}
value={(field.value ?? 0) as number} {...safeNumberFieldProps(field)}
onChange={(event) =>
field.onChange(event.target.valueAsNumber)
}
/> />
</FormControl> </FormControl>
<FormDescription> <FormDescription>
...@@ -1339,10 +1331,7 @@ export function PaymentSettingsSection({ ...@@ -1339,10 +1331,7 @@ export function PaymentSettingsSection({
type='number' type='number'
step='0.01' step='0.01'
min={0} min={0}
value={(field.value ?? 0) as number} {...safeNumberFieldProps(field)}
onChange={(event) =>
field.onChange(event.target.valueAsNumber)
}
/> />
</FormControl> </FormControl>
<FormDescription> <FormDescription>
......
...@@ -16,10 +16,12 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. ...@@ -16,10 +16,12 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com For commercial licensing, please contact support@quantumnous.com
*/ */
import { useEffect, useMemo, useRef } from 'react'
import * as z from 'zod' import * as z from 'zod'
import { useForm } from 'react-hook-form' import { useForm } from 'react-hook-form'
import { zodResolver } from '@hookform/resolvers/zod' import { zodResolver } from '@hookform/resolvers/zod'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import { toast } from 'sonner'
import { import {
Form, Form,
FormControl, FormControl,
...@@ -27,6 +29,7 @@ import { ...@@ -27,6 +29,7 @@ import {
FormField, FormField,
FormItem, FormItem,
FormLabel, FormLabel,
FormMessage,
} from '@/components/ui/form' } from '@/components/ui/form'
import { Input } from '@/components/ui/input' import { Input } from '@/components/ui/input'
import { Switch } from '@/components/ui/switch' import { Switch } from '@/components/ui/switch'
...@@ -37,48 +40,97 @@ import { ...@@ -37,48 +40,97 @@ import {
} from '../components/settings-form-layout' } from '../components/settings-form-layout'
import { SettingsPageFormActions } from '../components/settings-page-context' import { SettingsPageFormActions } from '../components/settings-page-context'
import { SettingsSection } from '../components/settings-section' import { SettingsSection } from '../components/settings-section'
import { useResetForm } from '../hooks/use-reset-form'
import { useUpdateOption } from '../hooks/use-update-option' import { useUpdateOption } from '../hooks/use-update-option'
import { safeNumberFieldProps } from '../utils/numeric-field'
const XAI_VIOLATION_FEE_DOC_URL = const XAI_VIOLATION_FEE_DOC_URL =
'https://docs.x.ai/docs/models#usage-guidelines-violation-fee' 'https://docs.x.ai/docs/models#usage-guidelines-violation-fee'
/**
* The schema uses a nested object so the dotted FormField `name` props line
* up with react-hook-form's path semantics. Using flat keys like
* `'grok.violation_deduction_enabled'` causes RHF to silently maintain two
* parallel value trees and saves never see the user input.
*/
const grokSchema = z.object({ const grokSchema = z.object({
'grok.violation_deduction_enabled': z.boolean(), grok: z.object({
'grok.violation_deduction_amount': z.coerce.number().min(0), violation_deduction_enabled: z.boolean(),
violation_deduction_amount: z.coerce.number().min(0),
}),
}) })
type GrokFormValues = z.infer<typeof grokSchema> type GrokFormInput = z.input<typeof grokSchema>
type GrokFormValues = z.output<typeof grokSchema>
type FlatGrokDefaults = {
'grok.violation_deduction_enabled': boolean
'grok.violation_deduction_amount': number
}
const buildFormDefaults = (defaults: FlatGrokDefaults): GrokFormInput => ({
grok: {
violation_deduction_enabled: defaults['grok.violation_deduction_enabled'],
violation_deduction_amount: defaults['grok.violation_deduction_amount'],
},
})
const normalizeFormValues = (values: GrokFormValues): FlatGrokDefaults => ({
'grok.violation_deduction_enabled': values.grok.violation_deduction_enabled,
'grok.violation_deduction_amount': values.grok.violation_deduction_amount,
})
interface Props { interface Props {
defaultValues: GrokFormValues defaultValues: FlatGrokDefaults
} }
export function GrokSettingsCard(props: Props) { export function GrokSettingsCard(props: Props) {
const { t } = useTranslation() const { t } = useTranslation()
const updateOption = useUpdateOption() const updateOption = useUpdateOption()
const form = useForm<GrokFormValues>({ const formDefaults = useMemo(
// eslint-disable-next-line @typescript-eslint/no-explicit-any () => buildFormDefaults(props.defaultValues),
resolver: zodResolver(grokSchema) as any, [props.defaultValues]
defaultValues: props.defaultValues, )
const form = useForm<GrokFormInput, unknown, GrokFormValues>({
resolver: zodResolver(grokSchema),
defaultValues: formDefaults,
}) })
// eslint-disable-next-line @typescript-eslint/no-explicit-any const baselineRef = useRef<FlatGrokDefaults>(props.defaultValues)
useResetForm(form as any, props.defaultValues) const baselineSerializedRef = useRef<string>(
JSON.stringify(props.defaultValues)
)
useEffect(() => {
const serialized = JSON.stringify(props.defaultValues)
if (serialized === baselineSerializedRef.current) return
baselineRef.current = props.defaultValues
baselineSerializedRef.current = serialized
form.reset(buildFormDefaults(props.defaultValues))
}, [props.defaultValues, form])
const onSubmit = async (values: GrokFormValues) => {
const normalized = normalizeFormValues(values)
const changedKeys = (
Object.keys(normalized) as Array<keyof FlatGrokDefaults>
).filter((key) => normalized[key] !== baselineRef.current[key])
const onSubmit = async (data: GrokFormValues) => { if (changedKeys.length === 0) {
const entries = Object.entries(data) as [string, unknown][] toast.info(t('No changes to save'))
const updates = entries.filter( return
([key, value]) => }
value !== (props.defaultValues[key as keyof GrokFormValues] as unknown)
) for (const key of changedKeys) {
for (const [key, value] of updates) {
await updateOption.mutateAsync({ await updateOption.mutateAsync({
key, key,
value: value as string | number | boolean, value: normalized[key],
}) })
} }
baselineRef.current = normalized
baselineSerializedRef.current = JSON.stringify(normalized)
form.reset(buildFormDefaults(normalized))
} }
const enabled = form.watch('grok.violation_deduction_enabled') const enabled = form.watch('grok.violation_deduction_enabled')
...@@ -133,7 +185,7 @@ export function GrokSettingsCard(props: Props) { ...@@ -133,7 +185,7 @@ export function GrokSettingsCard(props: Props) {
type='number' type='number'
step={0.01} step={0.01}
min={0} min={0}
{...field} {...safeNumberFieldProps(field)}
disabled={!enabled} disabled={!enabled}
/> />
</FormControl> </FormControl>
...@@ -142,6 +194,7 @@ export function GrokSettingsCard(props: Props) { ...@@ -142,6 +194,7 @@ export function GrokSettingsCard(props: Props) {
'Base amount. Actual deduction = base amount × system group rate.' 'Base amount. Actual deduction = base amount × system group rate.'
)} )}
</FormDescription> </FormDescription>
<FormMessage />
</FormItem> </FormItem>
)} )}
/> />
......
/*
Copyright (C) 2023-2026 QuantumNous
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import type { ChangeEvent } from 'react'
import type {
ControllerRenderProps,
FieldPath,
FieldValues,
} from 'react-hook-form'
/**
* Props produced by {@link safeNumberFieldProps} for a native
* `<input type="number">`. They are intentionally narrow so consumers can
* spread them onto our shared `Input` component without leaking the
* react-hook-form internals (e.g. `disabled`) that need overriding per call.
*/
export type SafeNumberFieldProps = {
value: number | ''
onChange: (event: ChangeEvent<HTMLInputElement>) => void
onBlur: () => void
name: string
ref: (instance: HTMLInputElement | null) => void
}
/**
* Adapter for binding a react-hook-form numeric field to a native
* `<input type="number">` without ever putting `NaN` into form state.
*
* Why this exists:
* - `<input type="number">` reports `valueAsNumber === NaN` whenever the field
* is empty or holds an in-progress non-numeric token (e.g. just a minus
* sign or a trailing dot). Forwarding `NaN` to `field.onChange` makes Zod
* numeric validators (`z.number().min(...)`, `z.coerce.number()`, etc.)
* fail at submit time, so `form.handleSubmit` silently refuses to call
* `onSubmit` — the save button appears frozen with no toast and no error.
* - The legacy Semi `InputNumber` avoids this by snapping the input back to
* the previous valid number. We replicate that behaviour by ignoring `NaN`
* updates: React's controlled-input reconciliation will restore the last
* valid value to the DOM on the next render.
*
* Display:
* - When the underlying state is not a finite number, the prop returns `''`
* so the input visibly renders empty instead of literal "NaN".
*
* Usage:
* ```tsx
* <FormField
* control={form.control}
* name='performance_setting.monitor_cpu_threshold'
* render={({ field }) => (
* <Input type='number' min={0} {...safeNumberFieldProps(field)} />
* )}
* />
* ```
*/
export function safeNumberFieldProps<
TFieldValues extends FieldValues,
TName extends FieldPath<TFieldValues>,
>(field: ControllerRenderProps<TFieldValues, TName>): SafeNumberFieldProps {
const raw = field.value as unknown
const display: number | '' =
typeof raw === 'number' && Number.isFinite(raw) ? raw : ''
return {
value: display,
onChange: (event) => {
const next = event.target.valueAsNumber
if (Number.isFinite(next)) {
;(field.onChange as (value: number) => void)(next)
}
},
onBlur: field.onBlur,
name: field.name,
ref: field.ref,
}
}
...@@ -357,7 +357,7 @@ export function useCommonLogsColumns(isAdmin: boolean): ColumnDef<UsageLog>[] { ...@@ -357,7 +357,7 @@ export function useCommonLogsColumns(isAdmin: boolean): ColumnDef<UsageLog>[] {
)} )}
</div> </div>
{log.channel_name && ( {log.channel_name && (
<span className='text-muted-foreground/70 truncate !text-xs [font-family:var(--font-body)]'> <span className='text-muted-foreground/70 truncate [font-family:var(--font-body)] !text-xs'>
{channelName} {channelName}
</span> </span>
)} )}
...@@ -502,7 +502,7 @@ export function useCommonLogsColumns(isAdmin: boolean): ColumnDef<UsageLog>[] { ...@@ -502,7 +502,7 @@ export function useCommonLogsColumns(isAdmin: boolean): ColumnDef<UsageLog>[] {
</Tooltip> </Tooltip>
</TooltipProvider> </TooltipProvider>
{metaParts.length > 0 && ( {metaParts.length > 0 && (
<span className='text-muted-foreground/60 truncate !text-xs [font-family:var(--font-body)]'> <span className='text-muted-foreground/60 truncate [font-family:var(--font-body)] !text-xs'>
{metaParts.join(' · ')} {metaParts.join(' · ')}
</span> </span>
)} )}
...@@ -598,8 +598,8 @@ export function useCommonLogsColumns(isAdmin: boolean): ColumnDef<UsageLog>[] { ...@@ -598,8 +598,8 @@ export function useCommonLogsColumns(isAdmin: boolean): ColumnDef<UsageLog>[] {
/> />
))} ))}
</div> </div>
<div className='flex items-center gap-1 !text-xs leading-none [font-family:var(--font-body)]'> <div className='flex items-center gap-1 [font-family:var(--font-body)] !text-xs leading-none'>
<span className='text-muted-foreground/60 !text-xs leading-none [font-family:var(--font-body)]'> <span className='text-muted-foreground/60 [font-family:var(--font-body)] !text-xs leading-none'>
{log.is_stream ? t('Stream') : t('Non-stream')} {log.is_stream ? t('Stream') : t('Non-stream')}
{tokensPerSecond != null && ( {tokensPerSecond != null && (
<> <>
...@@ -736,7 +736,7 @@ export function useCommonLogsColumns(isAdmin: boolean): ColumnDef<UsageLog>[] { ...@@ -736,7 +736,7 @@ export function useCommonLogsColumns(isAdmin: boolean): ColumnDef<UsageLog>[] {
return ( return (
<div className='flex flex-col gap-0.5'> <div className='flex flex-col gap-0.5'>
<span className='border-border/80 bg-muted/60 inline-flex w-fit items-center rounded-md border px-1.5 py-0.5 font-semibold tabular-nums [font-family:var(--font-body)]'> <span className='border-border/80 bg-muted/60 inline-flex w-fit items-center rounded-md border px-1.5 py-0.5 [font-family:var(--font-body)] font-semibold tabular-nums'>
{quotaStr} {quotaStr}
</span> </span>
</div> </div>
......
...@@ -101,12 +101,12 @@ function ModelBadgeContent(props: ModelBadgeProps) { ...@@ -101,12 +101,12 @@ function ModelBadgeContent(props: ModelBadgeProps) {
showDot={!provider} showDot={!provider}
autoColor={provider ? undefined : props.modelName} autoColor={provider ? undefined : props.modelName}
className={cn( className={cn(
'border-border/60 bg-muted/30 h-auto min-h-6 gap-1.5 rounded-md border px-2 py-0.5 whitespace-normal break-all [font-family:var(--font-body)]', 'border-border/60 bg-muted/30 h-auto min-h-6 gap-1.5 rounded-md border px-2 py-0.5 [font-family:var(--font-body)] break-all whitespace-normal',
provider && 'text-foreground', provider && 'text-foreground',
props.className props.className
)} )}
> >
<span className='flex items-center gap-1.5 min-w-0'> <span className='flex min-w-0 items-center gap-1.5'>
{provider && ( {provider && (
<span <span
className='flex size-3.5 shrink-0 items-center justify-center' className='flex size-3.5 shrink-0 items-center justify-center'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment