mirror of
https://github.com/lukaszraczylo/traefik-llmgateway.git
synced 2026-11-26 10:06:31 +00:00
fix(webui): models page sort, request totals, panel polish
This commit is contained in:
@@ -45,6 +45,8 @@ export interface ModelCatalogRow {
|
||||
aliases: string[]
|
||||
/** Smart routers that target this model. */
|
||||
routers?: string[]
|
||||
/** False when the range ranking (capped by the server) has no entry: requests is then 0 by absence, not a measured zero. */
|
||||
ranked?: boolean
|
||||
requests: number
|
||||
tokensIn: number
|
||||
tokensOut: number
|
||||
@@ -86,6 +88,7 @@ export function buildModelCatalogRows(
|
||||
displayFree: m.displayFree,
|
||||
aliases: m.aliases ?? [],
|
||||
routers: m.routers ?? [],
|
||||
ranked: usage !== undefined,
|
||||
requests: usage?.requests ?? 0,
|
||||
tokensIn: usage?.tokensIn ?? 0,
|
||||
tokensOut: usage?.tokensOut ?? 0,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
import { groupByProvider, priceStatus, selectModels } from '@/lib/models-view'
|
||||
import { groupByProvider, priceStatus, selectModels, sortThenSlice } from '@/lib/models-view'
|
||||
import type { ModelCatalogRow } from '@/lib/model-table-columns'
|
||||
|
||||
function row(id: string, over: Partial<ModelCatalogRow> = {}): ModelCatalogRow {
|
||||
@@ -68,3 +68,30 @@ describe('groupByProvider', () => {
|
||||
expect(g!.rows.map((r) => r.id)).toEqual(['a/c', 'a/a', 'a/b'])
|
||||
})
|
||||
})
|
||||
|
||||
describe('sortThenSlice', () => {
|
||||
const rows = [
|
||||
{ id: 'a', requests: 5, name: 'b' },
|
||||
{ id: 'b', requests: null, name: 'a' },
|
||||
{ id: 'c', requests: 9, name: 'c' },
|
||||
{ id: 'd', requests: 1, name: 'd' },
|
||||
]
|
||||
it('orders the whole list before taking the page', () => {
|
||||
const p0 = sortThenSlice(rows, { key: 'requests', direction: 'asc' }, 2, 0)
|
||||
const p1 = sortThenSlice(rows, { key: 'requests', direction: 'asc' }, 2, 1)
|
||||
expect(p0.map((r) => r.id)).toEqual(['d', 'a'])
|
||||
expect(p1.map((r) => r.id)).toEqual(['c', 'b'])
|
||||
})
|
||||
it('keeps missing values last in both directions', () => {
|
||||
expect(sortThenSlice(rows, { key: 'requests', direction: 'desc' }, 4, 0).map((r) => r.id)).toEqual(['c', 'a', 'd', 'b'])
|
||||
})
|
||||
it('sorts text and keeps input order without a sort', () => {
|
||||
expect(sortThenSlice(rows, { key: 'name', direction: 'asc' }, 4, 0).map((r) => r.id)).toEqual(['b', 'a', 'c', 'd'])
|
||||
expect(sortThenSlice(rows, null, 2, 1).map((r) => r.id)).toEqual(['c', 'd'])
|
||||
})
|
||||
it('clamps an out-of-range page and does not mutate the input', () => {
|
||||
const copy = [...rows]
|
||||
expect(sortThenSlice(rows, null, 3, 9).map((r) => r.id)).toEqual(['d'])
|
||||
expect(rows).toEqual(copy)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { filterModelRows } from '@/lib/model-filter'
|
||||
import { pageWindow } from '@/lib/paging'
|
||||
import type { ModelCatalogRow } from '@/lib/model-table-columns'
|
||||
|
||||
export type PriceStatus = 'priced' | 'unpriced' | 'free' | 'none'
|
||||
@@ -50,3 +51,31 @@ export function groupByProvider(rows: ModelCatalogRow[]): ProviderGroup[] {
|
||||
for (const g of groups.values()) g.rows.sort(byTraffic)
|
||||
return [...groups.values()]
|
||||
}
|
||||
|
||||
export interface SortSpec {
|
||||
key: string
|
||||
direction: 'asc' | 'desc'
|
||||
}
|
||||
|
||||
function compareCells(a: unknown, b: unknown): number {
|
||||
if (typeof a === 'number' && typeof b === 'number') return a - b
|
||||
return String(a).localeCompare(String(b))
|
||||
}
|
||||
|
||||
/** Sorts the whole list by `sort` (missing values last either way), then returns page `pageIndex` of it. */
|
||||
export function sortThenSlice<T extends object>(rows: readonly T[], sort: SortSpec | null, pageSize: number, pageIndex: number): T[] {
|
||||
let ordered = [...rows]
|
||||
if (sort) {
|
||||
const sign = sort.direction === 'asc' ? 1 : -1
|
||||
const cell = (r: T): unknown => (r as Record<string, unknown>)[sort.key]
|
||||
const missing = (v: unknown): boolean => v === null || v === undefined || v === ''
|
||||
ordered = ordered.sort((a, b) => {
|
||||
const x = cell(a)
|
||||
const y = cell(b)
|
||||
if (missing(x) || missing(y)) return Number(missing(x)) - Number(missing(y))
|
||||
return sign * compareCells(x, y)
|
||||
})
|
||||
}
|
||||
const w = pageWindow(ordered.length, pageSize, pageIndex)
|
||||
return ordered.slice(w.from, w.to)
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ import { computed, onMounted, reactive, watch } from 'vue'
|
||||
|
||||
import { formatCompactCount, formatContextWindow, formatModelCostHover } from '@/lib/format'
|
||||
import { loadState } from '@/lib/load-state'
|
||||
import { NO_KIND, groupByProvider, priceStatus, selectModels } from '@/lib/models-view'
|
||||
import type { ModelSelection, PriceStatus } from '@/lib/models-view'
|
||||
import { NO_KIND, groupByProvider, priceStatus, selectModels, sortThenSlice } from '@/lib/models-view'
|
||||
import type { ModelSelection, PriceStatus, SortSpec } from '@/lib/models-view'
|
||||
import { pageWindow } from '@/lib/paging'
|
||||
import { resolveSel } from '@/lib/panel-selection'
|
||||
import { breakerRows, providerRateStatus, providerSuccessRate } from '@/lib/provider-rate'
|
||||
@@ -19,6 +19,7 @@ import { useDashboardStore } from '@/stores/dashboard'
|
||||
import { useFiltersStore } from '@/stores/filters'
|
||||
import { useModelsStore } from '@/stores/models'
|
||||
import { useNavStore } from '@/stores/nav'
|
||||
import ModelName from '@/widgets/ModelName.vue'
|
||||
import StateView from '@/widgets/StateView.vue'
|
||||
import type { ViewState } from '@/widgets/StateView.vue'
|
||||
import WbTable from '@/widgets/WbTable.vue'
|
||||
@@ -42,7 +43,7 @@ interface Row {
|
||||
context: number | null
|
||||
price: PriceStatus
|
||||
priceTitle: string
|
||||
requests: number
|
||||
requests: number | null
|
||||
health: number | null
|
||||
healthTone: 'success' | 'warning' | 'danger' | null
|
||||
routers: string[]
|
||||
@@ -103,6 +104,16 @@ function applyFilters(items: FilterItem[]): void {
|
||||
setParams(patch)
|
||||
}
|
||||
|
||||
const providerNames = computed(() =>
|
||||
[...new Set([...overviewProviders.value.map((p) => p.name), ...models.rows.map((r) => r.providerName)])].sort(),
|
||||
)
|
||||
watch(
|
||||
[() => providerNames.value.join(','), () => filters.range],
|
||||
() => void models.fetchProviderRequests(providerNames.value),
|
||||
{ immediate: true },
|
||||
)
|
||||
const providerRequests = (provider: string): number | null => models.providerRequests?.[provider] ?? null
|
||||
|
||||
// --- Rows and groups ---------------------------------------------------------------
|
||||
|
||||
const selected = computed(() => selectModels(models.rows, selection.value))
|
||||
@@ -116,9 +127,22 @@ const groups = computed(() => {
|
||||
const seen = new Set(grouped.map((g) => g.provider))
|
||||
for (const p of overviewProviders.value) if (!seen.has(p.name)) grouped.push({ provider: p.name, rows: [], requests: 0 })
|
||||
}
|
||||
return grouped.sort((a, b) => b.requests - a.requests || a.provider.localeCompare(b.provider))
|
||||
const total = (p: string): number => providerRequests(p) ?? -1
|
||||
return grouped.sort((a, b) => total(b.provider) - total(a.provider) || a.provider.localeCompare(b.provider))
|
||||
})
|
||||
|
||||
// --- Sort (hash params sort, dir) ------------------------------------------------
|
||||
|
||||
const SORT_KEYS: readonly string[] = ['name', 'kind', 'context', 'price', 'requests']
|
||||
const sort = computed<SortSpec | null>(() => {
|
||||
const key = nav.params.sort
|
||||
return key && SORT_KEYS.includes(key) ? { key, direction: nav.params.dir === 'desc' ? 'desc' : 'asc' } : null
|
||||
})
|
||||
function onSort(next: SortSpec | null): void {
|
||||
pages.clear()
|
||||
setParams({ sort: next?.key ?? '', dir: next?.direction === 'desc' ? 'desc' : '' })
|
||||
}
|
||||
|
||||
function breakerStatus(provider: string): keyof typeof BREAKER_TONE {
|
||||
const b: BreakerRow | undefined = breakers.value.get(provider)
|
||||
if (!b) return 'closed'
|
||||
@@ -138,7 +162,7 @@ function toRow(r: (typeof models.rows)[number]): Row {
|
||||
context: r.contextTokens ?? null,
|
||||
price: priceStatus(r),
|
||||
priceTitle: known ? formatModelCostHover(r.inputPerMTokUsd as number, r.outputPerMTokUsd as number) : r.priceSource,
|
||||
requests: r.requests,
|
||||
requests: r.ranked === false ? null : r.requests,
|
||||
health: success === null ? null : Math.round(success * 1000) / 10,
|
||||
healthTone: status === 'no-traffic' ? null : HEALTH_TONE[status],
|
||||
routers,
|
||||
@@ -175,8 +199,7 @@ function pageOf(provider: string, total: number): number {
|
||||
return pageWindow(total, PAGE_SIZE, (pages.get(provider) ?? 1) - 1).index + 1
|
||||
}
|
||||
function rowsOf(g: (typeof groups.value)[number]): Row[] {
|
||||
const w = pageWindow(g.rows.length, PAGE_SIZE, pageOf(g.provider, g.rows.length) - 1)
|
||||
return g.rows.slice(w.from, w.to).map(toRow)
|
||||
return sortThenSlice(g.rows.map(toRow), sort.value, PAGE_SIZE, pageOf(g.provider, g.rows.length) - 1)
|
||||
}
|
||||
|
||||
// --- State, selection ----------------------------------------------------------------
|
||||
@@ -236,13 +259,13 @@ const openSel = computed(() => (models.lastUpdated !== null && dashboard.overvie
|
||||
>
|
||||
<span aria-hidden="true" class="inline-block transition-transform" :class="isOpen(g.provider, i, g.rows.length) ? 'rotate-90' : ''">›</span>
|
||||
</button>
|
||||
<button type="button" class="hover:underline min-w-0 truncate font-mono font-medium" :aria-label="`Open provider ${g.provider}`" @click="nav.openPanel('provider', g.provider)">
|
||||
<button type="button" class="hover:underline min-w-0 truncate font-medium" :aria-label="`Open provider ${g.provider}`" @click="nav.openPanel('provider', g.provider)">
|
||||
{{ g.provider }}
|
||||
</button>
|
||||
<StatusDot :tone="BREAKER_TONE[breakerStatus(g.provider)]" size="md" class="shrink-0" />
|
||||
<span v-if="breakerStatus(g.provider) !== 'closed'" class="text-muted-foreground shrink-0 text-xs">{{ breakerStatus(g.provider) }}</span>
|
||||
<span class="text-muted-foreground ml-auto shrink-0 font-mono text-xs tabular-nums">{{ g.rows.length.toLocaleString('en-US') }} models</span>
|
||||
<span class="text-muted-foreground hidden shrink-0 font-mono text-xs tabular-nums sm:inline">{{ formatCompactCount(g.requests) }} req</span>
|
||||
<span class="text-muted-foreground hidden shrink-0 font-mono text-xs tabular-nums sm:inline">{{ providerRequests(g.provider) === null ? '—' : formatCompactCount(providerRequests(g.provider) as number) }} req</span>
|
||||
</div>
|
||||
<div v-if="isOpen(g.provider, i, g.rows.length)" class="flex flex-col gap-2 p-1">
|
||||
<WbTable
|
||||
@@ -250,11 +273,13 @@ const openSel = computed(() => (models.lastUpdated !== null && dashboard.overvie
|
||||
:rows="rowsOf(g)"
|
||||
row-key="id"
|
||||
:active-key="activeModel"
|
||||
:sort="sort"
|
||||
@update:sort="onSort"
|
||||
:label="`${g.provider} models`"
|
||||
@row-activate="(row: Row) => nav.openPanel('model', row.id)"
|
||||
>
|
||||
<template #cell-name="{ row }">
|
||||
<span class="wb-model" :title="(row as Row).id"><span class="wb-model-name">{{ (row as Row).name }}</span></span>
|
||||
<ModelName :id="(row as Row).id" bare />
|
||||
</template>
|
||||
<template #cell-kind="{ value }">
|
||||
<span :class="value ? '' : 'text-muted-foreground'">{{ value || '—' }}</span>
|
||||
@@ -263,7 +288,7 @@ const openSel = computed(() => (models.lastUpdated !== null && dashboard.overvie
|
||||
<template #cell-price="{ row }">
|
||||
<Badge :tone="(row as Row).price === 'unpriced' ? 'warning' : 'neutral'" variant="outline" size="sm" :title="(row as Row).priceTitle">{{ (row as Row).price === 'none' ? '—' : (row as Row).price }}</Badge>
|
||||
</template>
|
||||
<template #cell-requests="{ value }">{{ formatCompactCount(value as number) }}</template>
|
||||
<template #cell-requests="{ value }">{{ value === null ? '—' : formatCompactCount(value as number) }}</template>
|
||||
<template #cell-health="{ row }">
|
||||
<span v-if="(row as Row).health === null" class="text-muted-foreground">—</span>
|
||||
<span v-else class="inline-flex items-center justify-end gap-1.5">
|
||||
|
||||
@@ -11,6 +11,7 @@ import { formatSel } from '@/lib/panel-selection'
|
||||
import { providerRateStatus, providerSuccessRate } from '@/lib/provider-rate'
|
||||
import { seriesUrl } from '@/lib/range'
|
||||
import { routersByModel } from '@/lib/router-index'
|
||||
import { useDashboardStore } from '@/stores/dashboard'
|
||||
import { useFiltersStore } from '@/stores/filters'
|
||||
import { useModelsStore } from '@/stores/models'
|
||||
import { useNavStore } from '@/stores/nav'
|
||||
@@ -35,6 +36,7 @@ type Snippet = 'meta' | 'price' | null
|
||||
const props = defineProps<{ id: string }>()
|
||||
const emit = defineEmits<{ close: [] }>()
|
||||
|
||||
const dashboard = useDashboardStore()
|
||||
const filters = useFiltersStore()
|
||||
const models = useModelsStore()
|
||||
const nav = useNavStore()
|
||||
@@ -46,6 +48,10 @@ const routers = computed(() => {
|
||||
const index = routersByModel(models.routers)
|
||||
return [...new Set([...(r.routers ?? []), ...(index.get(r.id) ?? [])])].sort()
|
||||
})
|
||||
const vision = computed(() => {
|
||||
const v = dashboard.overview?.providers.find((p) => p.name === row.value?.providerName)?.modelMeta?.[row.value?.model ?? '']?.vision
|
||||
return v === undefined ? 'unknown' : v ? 'yes' : 'no'
|
||||
})
|
||||
const status = computed(() => (row.value ? priceStatus(row.value) : 'none'))
|
||||
const priced = computed(() => row.value?.inputPerMTokUsd !== undefined && row.value?.outputPerMTokUsd !== undefined)
|
||||
const successRate = computed(() => (row.value ? providerSuccessRate(row.value.attempts, row.value.failures) : null))
|
||||
@@ -111,6 +117,7 @@ function openRouter(name: string): void {
|
||||
<DescriptionItem term="Context window">
|
||||
<span class="font-mono tabular-nums">{{ row.contextTokens !== undefined ? formatContextWindow(row.contextTokens) : '—' }}</span>
|
||||
</DescriptionItem>
|
||||
<DescriptionItem term="Vision">{{ vision }}</DescriptionItem>
|
||||
<DescriptionItem term="Aliases">
|
||||
<span v-if="row.aliases.length === 0" class="text-muted-foreground">none</span>
|
||||
<span v-else class="flex flex-wrap justify-end gap-1">
|
||||
@@ -140,7 +147,7 @@ function openRouter(name: string): void {
|
||||
|
||||
<PanelSection title="Usage in range">
|
||||
<DescriptionList variant="inline" size="sm" density="compact">
|
||||
<DescriptionItem term="Requests"><span class="font-mono tabular-nums">{{ formatCompactCount(row.requests) }}</span></DescriptionItem>
|
||||
<DescriptionItem term="Requests"><span class="font-mono tabular-nums">{{ row.ranked === false ? '—' : formatCompactCount(row.requests) }}</span></DescriptionItem>
|
||||
<DescriptionItem term="Tokens in / out">
|
||||
<span class="font-mono tabular-nums">{{ formatCompactCount(row.tokensIn) }} / {{ formatCompactCount(row.tokensOut) }}</span>
|
||||
</DescriptionItem>
|
||||
@@ -160,7 +167,15 @@ function openRouter(name: string): void {
|
||||
<p v-if="routers.length === 0" class="text-muted-foreground m-0 text-sm">No smart router targets this model.</p>
|
||||
<ul v-else class="m-0 flex list-none flex-col p-0" aria-label="Routers using this model">
|
||||
<li v-for="r in routers" :key="r" class="flex h-8 items-center">
|
||||
<button type="button" class="hover:bg-accent w-full truncate rounded px-2 text-left font-mono text-sm" @click="openRouter(r)">{{ r }}</button>
|
||||
<button
|
||||
type="button"
|
||||
class="hover:bg-accent focus-visible:ring-ring flex w-full items-center justify-between gap-2 rounded px-2 text-left font-mono text-sm underline decoration-dotted underline-offset-4 focus-visible:ring-2 focus-visible:outline-none"
|
||||
:aria-label="`Open router ${r}`"
|
||||
@click="openRouter(r)"
|
||||
>
|
||||
<span class="min-w-0 truncate">{{ r }}</span>
|
||||
<span aria-hidden="true" class="text-muted-foreground shrink-0 no-underline">→</span>
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
</PanelSection>
|
||||
|
||||
@@ -3,7 +3,8 @@ import { Button, DescriptionItem, DescriptionList, StatusBadge } from '@perfect-
|
||||
import { computed, ref } from 'vue'
|
||||
|
||||
import { copyText } from '@/lib/clipboard'
|
||||
import { formatAgo, formatCompactCount, formatLatencyMs, formatUntil } from '@/lib/format'
|
||||
import { formatCompactCount, formatLatencyMs, formatUntil } from '@/lib/format'
|
||||
import { formatLastSeen } from '@/lib/last-seen'
|
||||
import { breakerRows, providerRateStatus, providerSuccessRate } from '@/lib/provider-rate'
|
||||
import { useCopyFeedback } from '@/composables/useCopyFeedback'
|
||||
import { useDashboardStore } from '@/stores/dashboard'
|
||||
@@ -29,7 +30,10 @@ const breaker = computed(() => breakerRows(dashboard.overview).find((b) => b.pro
|
||||
const status = computed(() => (breaker.value?.degraded ? 'degraded' : (breaker.value?.state ?? 'closed')))
|
||||
const until = computed(() => formatUntil(breaker.value?.openUntil))
|
||||
|
||||
const lastDiscovery = computed(() => formatAgo(provider.value?.lastRefresh).trim().slice(1, -1) || '—')
|
||||
const lastDiscovery = computed(() => {
|
||||
const ms = Date.parse(provider.value?.lastRefresh ?? '')
|
||||
return formatLastSeen(Number.isNaN(ms) || ms <= 0 ? undefined : Math.floor(ms / 1000))
|
||||
})
|
||||
const perf = computed(() => models.providerPerf.find((r) => r.id === props.id))
|
||||
const successRate = computed(() => providerSuccessRate(provider.value?.attemptsDay ?? 0, provider.value?.failuresDay ?? 0))
|
||||
|
||||
@@ -87,7 +91,9 @@ function showAll(): void {
|
||||
</PanelSection>
|
||||
|
||||
<PanelSection title="Models">
|
||||
<p v-if="providerModels.length === 0" class="text-muted-foreground m-0 text-sm">No models listed for this provider.</p>
|
||||
<p v-if="providerModels.length === 0" class="text-muted-foreground m-0 text-sm break-words">
|
||||
No models discovered<template v-if="provider.lastErr">. Last error: {{ provider.lastErr }}</template><template v-else> for this provider.</template>
|
||||
</p>
|
||||
<template v-else>
|
||||
<ul class="m-0 flex list-none flex-col p-0" aria-label="Provider models">
|
||||
<li v-for="m in shownModels" :key="m.id">
|
||||
|
||||
@@ -5,8 +5,12 @@ import { buildModelCatalogRows } from '@/lib/model-table-columns'
|
||||
import type { ModelCatalogRow } from '@/lib/model-table-columns'
|
||||
import { useCatalogStore } from '@/stores/catalog'
|
||||
import { useFiltersStore } from '@/stores/filters'
|
||||
import { seriesUrl } from '@/lib/range'
|
||||
import { hourOrDayWindow } from '@/stores/reliability'
|
||||
import type { AdminPerfResponse, AdminPerfRow, AdminRouterView, AdminUsageModelsResponse, HistoryWindow } from '@/types/api'
|
||||
import type { AdminPerfResponse, AdminPerfRow, AdminRouterView, AdminSeriesResponse, AdminUsageModelsResponse, HistoryWindow } from '@/types/api'
|
||||
|
||||
/** The series endpoint accepts at most this many scopes per call. */
|
||||
const PROVIDER_SERIES_MAX = 100
|
||||
|
||||
/**
|
||||
* useModelsStore fetches the Models page's own catalog table (redesign-
|
||||
@@ -37,6 +41,8 @@ export const useModelsStore = defineStore('models', {
|
||||
perfWindow: { window: 'day' as Extract<HistoryWindow, 'hour' | 'day'>, span: 0 },
|
||||
/** GET /admin/api/performance's own latencyEnabled (AdminPerfResponse) — shared by BOTH the model and provider performance requests below (the same admin.stats.latency toggle gates both), surfaced so ModelCatalogTable.vue/ProviderHealthPanel.vue can hint at it rather than silently showing every row's p50/p95 as "—". */
|
||||
latencyEnabled: false,
|
||||
/** Requests per provider over the range, from the provider series (not capped like the model ranking); null until loaded or when unavailable. */
|
||||
providerRequests: null as Record<string, number> | null,
|
||||
loading: false,
|
||||
lastUpdated: null as Date | null,
|
||||
error: '',
|
||||
@@ -44,6 +50,21 @@ export const useModelsStore = defineStore('models', {
|
||||
reqId: 0,
|
||||
}),
|
||||
actions: {
|
||||
/** Sums the per-provider request series for the global range. Failure leaves totals null so the page shows a dash, never a false 0. */
|
||||
async fetchProviderRequests(names: string[]): Promise<void> {
|
||||
if (names.length === 0) return
|
||||
const filters = useFiltersStore()
|
||||
try {
|
||||
const res = await adminFetch<AdminSeriesResponse>(
|
||||
seriesUrl({ scope: names.slice(0, PROVIDER_SERIES_MAX).map((n) => `provider:${n}`), metric: 'req', window: filters.window, span: filters.span }),
|
||||
)
|
||||
const totals: Record<string, number> = {}
|
||||
for (const s of res.series) totals[s.scope.replace(/^provider:/, '')] = s.points.reduce((a, v) => a + v, 0)
|
||||
this.providerRequests = totals
|
||||
} catch (err) {
|
||||
if (!isAuthRejection(err)) this.providerRequests = null
|
||||
}
|
||||
},
|
||||
async fetch(): Promise<void> {
|
||||
const requestId = ++this.reqId
|
||||
this.loading = true
|
||||
|
||||
@@ -52,6 +52,8 @@ export interface AdminModelMetaView {
|
||||
contextTokens?: number
|
||||
inputPerMTokUsd?: number
|
||||
outputPerMTokUsd?: number
|
||||
/** Explicit modelMeta.vision; absent when unset (unknown). */
|
||||
vision?: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,13 +3,13 @@ import { computed } from 'vue'
|
||||
|
||||
import { splitModelId } from '@/lib/model-id'
|
||||
|
||||
const props = defineProps<{ id: string }>()
|
||||
const props = defineProps<{ id: string; bare?: boolean }>()
|
||||
const parts = computed(() => splitModelId(props.id))
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<span class="wb-model" :title="id">
|
||||
<span v-if="parts.provider" class="wb-model-provider">{{ parts.provider }}</span>
|
||||
<span v-if="parts.provider && !bare" class="wb-model-provider">{{ parts.provider }}</span>
|
||||
<span class="wb-model-name">{{ parts.model }}</span>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user