mirror of
https://github.com/lukaszraczylo/traefik-llmgateway.git
synced 2026-12-06 11:03:52 +00:00
fix(admin): show aliases, guard the provider filter, tolerate failing upstreams (#23)
* fix(admin): attach model aliases to the model their target resolves to The catalog grouped aliases by the raw target string and looked them up by canonical provider/model id. A bare target never matched, so no model card listed its aliases. Each alias now keys on the canonical id that the registry resolves its target to. The alias view gains an additive resolvedTarget field. Model-id cells in the overview, usage and panels now show an alias badge with the target, using the catalog alias list. * fix(webui): omit the provider filter select until providers load * fix(discovery): tolerate failing modelBaseUrls upstreams A modelBaseUrls upstream that fails /v1/models must not fail the provider. Discovery now fails only when baseUrl fails. The explicit models of the failing upstream stay listed, and the other upstreams still merge. The admin overview reports each failed upstream in the additive upstreamErrors field. The registry logs it at most once per 10 minutes per provider. The README states the new semantics. * chore(webui): regenerate admin assets Rebuilt with make admin-ui for the alias badge and the provider filter changes. * style(auth): order authStore fields for fieldalignment golangci-lint's fieldalignment check reported 240 leading pointer bytes on authStore where 232 is optimal. The bool anonymousAnyKey moves next to the mutexes. No behaviour change.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import type { FilterField } from '@perfect-design/ui'
|
||||
|
||||
import { filterModelRows } from '@/lib/model-filter'
|
||||
import type { ModelCatalogRow } from '@/lib/model-table-columns'
|
||||
|
||||
@@ -50,3 +52,23 @@ export function groupByProvider(rows: ModelCatalogRow[]): ProviderGroup[] {
|
||||
for (const g of groups.values()) g.rows.sort(byTraffic)
|
||||
return [...groups.values()]
|
||||
}
|
||||
|
||||
const PRICE_OPTIONS: Array<{ value: PriceStatus; label: string }> = [
|
||||
{ value: 'priced', label: 'Priced' },
|
||||
{ value: 'unpriced', label: 'Unpriced' },
|
||||
{ value: 'free', label: 'Free' },
|
||||
]
|
||||
|
||||
/**
|
||||
* FilterBar throws on a select without options, so the provider select is
|
||||
* omitted until a provider is known; a provider already in the URL counts as known.
|
||||
*/
|
||||
export function modelFilterFields(providers: string[], kinds: string[], activeProvider?: string): FilterField[] {
|
||||
const names = [...new Set([...providers, ...(activeProvider ? [activeProvider] : [])])].sort()
|
||||
const toOptions = (vs: string[]) => vs.map((v) => ({ value: v, label: v }))
|
||||
return [
|
||||
...(names.length > 0 ? [{ id: 'provider', label: 'Provider', type: 'select' as const, operators: ['eq' as const], options: toOptions(names) }] : []),
|
||||
{ id: 'kind', label: 'Kind', type: 'select', operators: ['eq'], options: [{ value: NO_KIND, label: 'No kind' }, ...toOptions(kinds)] },
|
||||
{ id: 'price', label: 'Price', type: 'select', operators: ['eq'], options: PRICE_OPTIONS },
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user