Skip to content

7.4 billion tokens per month. 34 free LLM providers. 635 free model endpoints. All behind one /v1 endpoint, plus any custom OpenAI-compatible endpoint. Smart routing, automatic failover, encrypted keys. Personal experimentation only.

TypeScript

fix(models): group axis bars fill from the left like single-provider bars (#1579)

Tashfeen65525c6f3288
diff --git a/client/src/components/model-table.range-bar.test.tsx b/client/src/components/model-table.range-bar.test.tsx
new file mode 100644
index 00000000..1a2e7483
--- /dev/null
+++ b/client/src/components/model-table.range-bar.test.tsx
@@ -0,0 +1,38 @@
+// @vitest-environment jsdom
+// Group rows (#580) show an axis across providers. The bar must read like the
+// filled single-provider bars beside it: solid up to the weakest provider,
+// faded up to the strongest, label "lo–hi".
+import { afterEach, beforeAll, beforeEach, expect, it } from 'vitest'
+import { act } from 'react'
+import { createRoot, type Root } from 'react-dom/client'
+import { AxisRangeBar } from './model-table'
+
+let root: Root
+let container: HTMLDivElement
+beforeAll(() => { (globalThis as unknown as { IS_REACT_ACT_ENVIRONMENT: boolean }).IS_REACT_ACT_ENVIRONMENT = true })
+beforeEach(() => { container = document.createElement('div'); document.body.appendChild(container); root = createRoot(container) })
+afterEach(() => { act(() => root.unmount()); container.remove() })
+
+const render = (values: (number | undefined)[]) => act(() => root.render(<AxisRangeBar values={values} color="#22c55e" />))
+const part = (name: string) => container.querySelector<HTMLElement>(`[data-part="${name}"]`)
+
+it('fills solid to the low value and faded to the high value, both from the left', () => {
+ render([0.98, 0.63])
+ expect(part('floor')!.style.width).toBe('63%')
+ expect(part('spread')!.style.width).toBe('98%')
+ for (const p of [part('floor')!, part('spread')!]) expect(p.className).toContain('left-0')
+ expect(container.textContent).toContain('63–98')
+})
+
+it('a narrow spread still reads as a filled bar, not a sliver', () => {
+ render([0.55, 0.59])
+ expect(part('floor')!.style.width).toBe('55%')
+ expect(part('spread')!.style.width).toBe('59%')
+})
+
+it('collapses to the plain bar when providers agree, and ignores unmeasured ones', () => {
+ render([0.7, undefined, 0.7])
+ expect(part('floor')).toBeNull()
+ expect(container.textContent).toContain('70')
+ expect(container.textContent).not.toContain('–70')
+})
diff --git a/client/src/components/model-table.tsx b/client/src/components/model-table.tsx
index 558b6741..d8b3646e 100644
--- a/client/src/components/model-table.tsx
+++ b/client/src/components/model-table.tsx
@@ -63,11 +63,14 @@ function rangeOf(values: (number | undefined)[]): { min: number; max: number } |
return { min: Math.min(...nums), max: Math.max(...nums) }
}
-// A group's axis as a min–max band across its providers, collapsing to the
-// plain single-value bar when the providers agree (or there is only one).
-// Groups show the true spread instead of silently promoting the best member's
-// number to the whole group (#580).
-function AxisRangeBar({ values, color }: { values: (number | undefined)[]; color: string }) {
+// A group's axis across its providers, collapsing to the plain single-value bar
+// when the providers agree (or there is only one). Groups show the true spread
+// instead of silently promoting the best member's number to the whole group
+// (#580). Drawn as a solid fill up to the weakest provider plus a faded
+// stretch up to the strongest, so it lines up with the filled single-provider
+// bars around it: a band floating mid-track (or a 4% sliver for a narrow
+// spread) read as a broken bar.
+export function AxisRangeBar({ values, color }: { values: (number | undefined)[]; color: string }) {
const range = rangeOf(values)
if (range === null) return <AxisBar value={undefined} color={color} />
const lo = Math.round(range.min * 100)
@@ -77,8 +80,14 @@ function AxisRangeBar({ values, color }: { values: (number | undefined)[]; color
<div className="flex items-center gap-1.5">
<div className="relative h-1.5 w-12 rounded-full bg-muted overflow-hidden">
<div
- className="absolute inset-y-0 rounded-full"
- style={{ left: `${lo}%`, width: `${Math.max(4, hi - lo)}%`, backgroundColor: color }}
+ data-part="spread"
+ className="absolute inset-y-0 left-0 rounded-full opacity-35"
+ style={{ width: `${hi}%`, backgroundColor: color }}
+ />
+ <div
+ data-part="floor"
+ className="absolute inset-y-0 left-0 rounded-full"
+ style={{ width: `${lo}%`, backgroundColor: color }}
/>
</div>
<span className="font-mono text-[11px] text-muted-foreground tabular-nums min-w-7 text-right whitespace-nowrap">