mirror of
https://github.com/rennf93/roboco.git
synced 2026-08-03 07:23:24 +02:00
fix: post-finale completeness sweep — routing surface, provider config, budgets, compose env, interactive exemption (#661)
This commit is contained in:
@@ -50,6 +50,11 @@ const {
|
||||
provider_type: "openai",
|
||||
display_name: "GPT-5.3 Codex",
|
||||
},
|
||||
{
|
||||
model_name: "gemini-2.5-pro",
|
||||
provider_type: "gemini",
|
||||
display_name: "Gemini 2.5 Pro",
|
||||
},
|
||||
]),
|
||||
getOllamaKey: vi.fn(async () => ({ has_key: false, enabled: true })),
|
||||
setOllamaKey: vi.fn(async () => ({ has_key: true, enabled: true })),
|
||||
@@ -387,6 +392,13 @@ function withQueryClient(ui: ReactNode) {
|
||||
return <QueryClientProvider client={client}>{ui}</QueryClientProvider>;
|
||||
}
|
||||
|
||||
// Finds a per-agent Mix row's container div by its agent-id text. `.closest`
|
||||
// on a non-tag-name CSS selector types as `Element | null`, not `HTMLElement`
|
||||
// — cast once here rather than at every call site.
|
||||
function mixRowFor(agentId: string): HTMLElement {
|
||||
return screen.getByText(agentId).closest("div.grid") as HTMLElement;
|
||||
}
|
||||
|
||||
describe("AIRoutingCard", () => {
|
||||
beforeEach(() => {
|
||||
catalog.mockClear();
|
||||
@@ -761,6 +773,102 @@ describe("AIRoutingCard", () => {
|
||||
});
|
||||
});
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Codex and Gemini mode buttons + Mix picker visibility (the headline gap:
|
||||
// both were built but unreachable from the panel — no apply-mode card, no
|
||||
// Mix group).
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
describe("Codex and Gemini mode buttons", () => {
|
||||
it("renders the Codex button and applies mode='codex' on confirm", async () => {
|
||||
const confirmSpy = vi.spyOn(window, "confirm").mockReturnValue(true);
|
||||
render(withQueryClient(<AIRoutingCard />));
|
||||
await screen.findByText("Grok (xAI) API key");
|
||||
|
||||
fireEvent.click(screen.getByText("Codex"));
|
||||
|
||||
await waitFor(() =>
|
||||
expect(applyMode).toHaveBeenCalledWith({ mode: "codex" }),
|
||||
);
|
||||
confirmSpy.mockRestore();
|
||||
});
|
||||
|
||||
it("renders the Gemini button and applies mode='gemini' on confirm", async () => {
|
||||
const confirmSpy = vi.spyOn(window, "confirm").mockReturnValue(true);
|
||||
render(withQueryClient(<AIRoutingCard />));
|
||||
await screen.findByText("Grok (xAI) API key");
|
||||
|
||||
fireEvent.click(screen.getByText("Gemini"));
|
||||
|
||||
await waitFor(() =>
|
||||
expect(applyMode).toHaveBeenCalledWith({ mode: "gemini" }),
|
||||
);
|
||||
confirmSpy.mockRestore();
|
||||
});
|
||||
|
||||
it("neither button is gated on a key (no key card exists for either provider)", async () => {
|
||||
render(withQueryClient(<AIRoutingCard />));
|
||||
await screen.findByText("Grok (xAI) API key");
|
||||
|
||||
expect(screen.getByText("Codex").closest("button")).not.toBeDisabled();
|
||||
expect(screen.getByText("Gemini").closest("button")).not.toBeDisabled();
|
||||
});
|
||||
});
|
||||
|
||||
describe("Mix picker Codex/Gemini group visibility", () => {
|
||||
it("shows Codex and Gemini provider groups for a delivery role's per-agent select", async () => {
|
||||
render(withQueryClient(<AIRoutingCard />));
|
||||
await screen.findByText("Per-agent override (mix mode)");
|
||||
|
||||
const beDevRow = mixRowFor("be-dev-1");
|
||||
// The catalog query resolves asynchronously — the per-agent groups are
|
||||
// absent on the first render pass, so wait for them (findByText) rather
|
||||
// than asserting synchronously.
|
||||
expect(
|
||||
await within(beDevRow).findByText("Codex (OpenAI)"),
|
||||
).toBeInTheDocument();
|
||||
expect(
|
||||
within(beDevRow).getByText("Gemini (Google)"),
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("excludes Codex and Gemini from the Intake/Secretary/PR Review group, with an inline note", async () => {
|
||||
render(withQueryClient(<AIRoutingCard />));
|
||||
await screen.findByText("Per-agent override (mix mode)");
|
||||
|
||||
expect(
|
||||
screen.getByText(/Codex and Gemini are delivery-roles-only/i),
|
||||
).toBeInTheDocument();
|
||||
|
||||
// Wait for the catalog query to resolve (an unrelated row's groups)
|
||||
// before asserting absence on this group's rows below.
|
||||
await within(mixRowFor("be-dev-1")).findByText("Codex (OpenAI)");
|
||||
|
||||
const secretaryRow = mixRowFor("secretary-1");
|
||||
expect(
|
||||
within(secretaryRow).queryByText("Codex (OpenAI)"),
|
||||
).not.toBeInTheDocument();
|
||||
expect(
|
||||
within(secretaryRow).queryByText("Gemini (Google)"),
|
||||
).not.toBeInTheDocument();
|
||||
|
||||
const intakeRow = mixRowFor("intake-1");
|
||||
expect(
|
||||
within(intakeRow).queryByText("Codex (OpenAI)"),
|
||||
).not.toBeInTheDocument();
|
||||
expect(
|
||||
within(intakeRow).queryByText("Gemini (Google)"),
|
||||
).not.toBeInTheDocument();
|
||||
|
||||
// The root PR reviewer shares the same group/note, even though it is
|
||||
// technically one-shot-capable — the panel restricts the whole group.
|
||||
const prReviewerRow = mixRowFor("pr-reviewer-1");
|
||||
expect(
|
||||
within(prReviewerRow).queryByText("Codex (OpenAI)"),
|
||||
).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Mode switches preserve complexity overrides (2026-07-17-style incident:
|
||||
// these same buttons once wiped AGENT_SLUG pins) — the confirm text says so
|
||||
|
||||
@@ -40,8 +40,10 @@ import {
|
||||
import { Separator } from "@/components/ui/separator";
|
||||
import {
|
||||
AlertTriangle,
|
||||
Bot,
|
||||
Cpu,
|
||||
Gauge,
|
||||
Gem,
|
||||
Key,
|
||||
KeyRound,
|
||||
Server,
|
||||
@@ -115,6 +117,12 @@ const AGENT_GROUP_DEFS: {
|
||||
},
|
||||
];
|
||||
|
||||
// Codex/Gemini are V1 delivery-roles-only — no interactive Intake/Secretary
|
||||
// support (see roboco.llm.providers.codex / .gemini). This group's per-agent
|
||||
// picker excludes both providers below instead of offering a route that
|
||||
// would silently misroute the persistent Intake/Secretary session at spawn.
|
||||
const INTERACTIVE_ONLY_GROUP_TITLE = "Intake / Secretary / PR Review";
|
||||
|
||||
// Stable within-group ordering (PM/lead first, devs, QA, doc, reviewer last)
|
||||
// so the picker doesn't churn alphabetically as the live roster loads —
|
||||
// ties (e.g. dev-1/dev-2) break on slug, which already sorts correctly.
|
||||
@@ -280,6 +288,10 @@ export function AIRoutingCard() {
|
||||
(c: { provider_type: ModelProvider }) =>
|
||||
c.provider_type === ModelProvider.OPENAI,
|
||||
);
|
||||
const catalogGeminiOnly = catalog.filter(
|
||||
(c: { provider_type: ModelProvider }) =>
|
||||
c.provider_type === ModelProvider.GEMINI,
|
||||
);
|
||||
const catalogAnthropicOnly = catalog.filter(
|
||||
(c: { provider_type: ModelProvider }) =>
|
||||
c.provider_type === ModelProvider.ANTHROPIC,
|
||||
@@ -326,6 +338,46 @@ export function AIRoutingCard() {
|
||||
}
|
||||
};
|
||||
|
||||
const flipToCodex = async () => {
|
||||
if (
|
||||
!confirm(
|
||||
"Switch every agent to Codex? Per-agent pins and complexity " +
|
||||
"overrides are kept; other role/global assignments are replaced. " +
|
||||
"Intake and Secretary stay on Anthropic (Codex has no interactive " +
|
||||
"chat support).",
|
||||
)
|
||||
)
|
||||
return;
|
||||
try {
|
||||
await applyMode.mutateAsync({ mode: "codex" });
|
||||
toast.success(
|
||||
"Role/global routing now on Codex — pins/overrides kept, Intake & Secretary stay on Anthropic",
|
||||
);
|
||||
} catch (e) {
|
||||
toast.error("Switch failed: " + errMsg(e));
|
||||
}
|
||||
};
|
||||
|
||||
const flipToGemini = async () => {
|
||||
if (
|
||||
!confirm(
|
||||
"Switch every agent to Gemini? Per-agent pins and complexity " +
|
||||
"overrides are kept; other role/global assignments are replaced. " +
|
||||
"Intake and Secretary stay on Anthropic (Gemini has no interactive " +
|
||||
"chat support).",
|
||||
)
|
||||
)
|
||||
return;
|
||||
try {
|
||||
await applyMode.mutateAsync({ mode: "gemini" });
|
||||
toast.success(
|
||||
"Role/global routing now on Gemini — pins/overrides kept, Intake & Secretary stay on Anthropic",
|
||||
);
|
||||
} catch (e) {
|
||||
toast.error("Switch failed: " + errMsg(e));
|
||||
}
|
||||
};
|
||||
|
||||
const flipToOllama = async () => {
|
||||
if (!hasOllamaKey) {
|
||||
toast.error("Save an Ollama API key first");
|
||||
@@ -551,6 +603,126 @@ export function AIRoutingCard() {
|
||||
}
|
||||
};
|
||||
|
||||
// The full per-agent model-picker option list, shared by every group's
|
||||
// Select — factored out so the Codex/Gemini exclusion for the interactive
|
||||
// group (`restrictInteractiveOnly`) doesn't require duplicating the whole
|
||||
// catalog-grouped SelectContent tree.
|
||||
const renderMixSelectOptions = (restrictInteractiveOnly: boolean) => (
|
||||
<>
|
||||
<SelectItem value="__clear__">(inherit global)</SelectItem>
|
||||
|
||||
{/* Anthropic models */}
|
||||
{catalogAnthropicOnly.length > 0 && (
|
||||
<SelectGroup>
|
||||
<SelectLabel>
|
||||
<ProviderBadge variant="anthropic" />
|
||||
Anthropic
|
||||
</SelectLabel>
|
||||
{catalogAnthropicOnly.map(
|
||||
(c: { model_name: string; display_name: string }) => (
|
||||
<SelectItem key={c.model_name} value={c.model_name}>
|
||||
{c.display_name}
|
||||
</SelectItem>
|
||||
),
|
||||
)}
|
||||
</SelectGroup>
|
||||
)}
|
||||
|
||||
{/* Grok (xAI) models */}
|
||||
{catalogGrokOnly.length > 0 && (
|
||||
<SelectGroup>
|
||||
<SelectLabel>
|
||||
<ProviderBadge variant="grok" />
|
||||
Grok (xAI)
|
||||
</SelectLabel>
|
||||
{catalogGrokOnly.map(
|
||||
(c: { model_name: string; display_name: string }) => (
|
||||
<SelectItem key={c.model_name} value={c.model_name}>
|
||||
{c.display_name}
|
||||
</SelectItem>
|
||||
),
|
||||
)}
|
||||
</SelectGroup>
|
||||
)}
|
||||
|
||||
{/* Codex (OpenAI) models — excluded for the interactive-only group */}
|
||||
{!restrictInteractiveOnly && catalogOpenaiOnly.length > 0 && (
|
||||
<SelectGroup>
|
||||
<SelectLabel>
|
||||
<ProviderBadge variant="openai" />
|
||||
Codex (OpenAI)
|
||||
</SelectLabel>
|
||||
{catalogOpenaiOnly.map(
|
||||
(c: { model_name: string; display_name: string }) => (
|
||||
<SelectItem key={c.model_name} value={c.model_name}>
|
||||
{c.display_name}
|
||||
</SelectItem>
|
||||
),
|
||||
)}
|
||||
</SelectGroup>
|
||||
)}
|
||||
|
||||
{/* Gemini (Google) models — excluded for the interactive-only group */}
|
||||
{!restrictInteractiveOnly && catalogGeminiOnly.length > 0 && (
|
||||
<SelectGroup>
|
||||
<SelectLabel>
|
||||
<ProviderBadge variant="gemini" />
|
||||
Gemini (Google)
|
||||
</SelectLabel>
|
||||
{catalogGeminiOnly.map(
|
||||
(c: { model_name: string; display_name: string }) => (
|
||||
<SelectItem key={c.model_name} value={c.model_name}>
|
||||
{c.display_name}
|
||||
</SelectItem>
|
||||
),
|
||||
)}
|
||||
</SelectGroup>
|
||||
)}
|
||||
|
||||
{/* Ollama Cloud models */}
|
||||
{catalogOllamaOnly.length > 0 && (
|
||||
<SelectGroup>
|
||||
<SelectLabel>
|
||||
<ProviderBadge variant="ollama" />
|
||||
Ollama Cloud
|
||||
</SelectLabel>
|
||||
{catalogOllamaOnly.map(
|
||||
(c: { model_name: string; display_name: string }) => (
|
||||
<SelectItem key={c.model_name} value={c.model_name}>
|
||||
{c.display_name}
|
||||
</SelectItem>
|
||||
),
|
||||
)}
|
||||
</SelectGroup>
|
||||
)}
|
||||
|
||||
{/* Self-Hosted models */}
|
||||
{selfHostedModels.length > 0 && (
|
||||
<SelectGroup>
|
||||
<SelectLabel>
|
||||
<ProviderBadge variant="self-hosted" />
|
||||
Self-Hosted
|
||||
</SelectLabel>
|
||||
{selfHostedModels.map((m: SelfHostedModel) => (
|
||||
<SelectItem key={m.model_name} value={m.model_name}>
|
||||
{m.display_name}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectGroup>
|
||||
)}
|
||||
|
||||
{/* Fallback: un-grouped catalog when no grouping is possible */}
|
||||
{catalogAnthropicOnly.length === 0 &&
|
||||
catalogOllamaOnly.length === 0 &&
|
||||
selfHostedModels.length === 0 &&
|
||||
catalogForMix.map((c: { model_name: string; display_name: string }) => (
|
||||
<SelectItem key={c.model_name} value={c.model_name}>
|
||||
{c.display_name} — {c.model_name}
|
||||
</SelectItem>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
|
||||
return (
|
||||
<Card>
|
||||
<CardHeader>
|
||||
@@ -560,8 +732,10 @@ export function AIRoutingCard() {
|
||||
<CardDescription>
|
||||
Decide which model backs each agent. Anthropic uses the mounted
|
||||
<code className="px-1"> ~/.claude </code> auth; Grok (xAI) and Ollama
|
||||
Cloud use the API keys you save below; Self-Hosted connects to any
|
||||
OpenAI-compatible endpoint you run locally.
|
||||
Cloud use the API keys you save below; Codex and Gemini authenticate
|
||||
via their own mounted CLI subscriptions (no key needed) — V1:
|
||||
delivery roles only, not Intake/Secretary; Self-Hosted connects to
|
||||
any OpenAI-compatible endpoint you run locally.
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-6">
|
||||
@@ -700,10 +874,10 @@ export function AIRoutingCard() {
|
||||
|
||||
{/* -------- Mode toggle -------- */}
|
||||
<section className="space-y-3">
|
||||
<HelpTip label="Anthropic / Grok / Ollama / Self-Hosted replace role/global routing with that provider; per-agent pins in the table below survive the switch. Mix keeps whatever's picked in the table.">
|
||||
<HelpTip label="Anthropic / Grok / Codex / Gemini / Ollama / Self-Hosted replace role/global routing with that provider; per-agent pins in the table below survive the switch. Mix keeps whatever's picked in the table.">
|
||||
<Label className="text-sm font-medium">Routing mode</Label>
|
||||
</HelpTip>
|
||||
<div className="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-2">
|
||||
<div className="grid grid-cols-2 md:grid-cols-4 lg:grid-cols-8 gap-2">
|
||||
<ModeButton
|
||||
icon={<ShieldCheck className="h-4 w-4" />}
|
||||
label="Anthropic"
|
||||
@@ -724,6 +898,24 @@ export function AIRoutingCard() {
|
||||
onClick={flipToGrok}
|
||||
disabled={applyMode.isPending || !hasGrokKey}
|
||||
/>
|
||||
<ModeButton
|
||||
icon={<Bot className="h-4 w-4" />}
|
||||
label="Codex"
|
||||
description="Every agent uses Codex (gpt-5.3-codex)."
|
||||
active={currentMode === "codex"}
|
||||
onClick={flipToCodex}
|
||||
disabled={applyMode.isPending}
|
||||
labelHint="Codex authenticates via a mounted ~/.codex subscription (ChatGPT, no API key) — always available once the CLI is logged in on the host. V1: delivery roles only, not offered for Intake/Secretary."
|
||||
/>
|
||||
<ModeButton
|
||||
icon={<Gem className="h-4 w-4" />}
|
||||
label="Gemini"
|
||||
description="Every agent uses Gemini (gemini-2.5-pro)."
|
||||
active={currentMode === "gemini"}
|
||||
onClick={flipToGemini}
|
||||
disabled={applyMode.isPending}
|
||||
labelHint="Gemini authenticates via a mounted ~/.gemini OAuth login (no API key) — always available once the CLI is logged in on the host. V1: delivery roles only, not offered for Intake/Secretary."
|
||||
/>
|
||||
<ModeButton
|
||||
icon={<Sparkles className="h-4 w-4" />}
|
||||
label="Ollama"
|
||||
@@ -784,6 +976,22 @@ export function AIRoutingCard() {
|
||||
per-agent cost cap all apply.
|
||||
</p>
|
||||
) : null}
|
||||
{currentMode === "codex" || currentMode === "mix" ? (
|
||||
<p className="text-xs text-muted-foreground">
|
||||
Codex agents run on OpenAI's official Codex CLI (ChatGPT
|
||||
subscription, mounted ~/.codex); the same command /
|
||||
secret-exfiltration guard, prompt-injection guard, and per-agent
|
||||
cost cap apply. V1: delivery roles only — not available for
|
||||
Intake/Secretary.
|
||||
</p>
|
||||
) : null}
|
||||
{currentMode === "gemini" || currentMode === "mix" ? (
|
||||
<p className="text-xs text-muted-foreground">
|
||||
Gemini agents run on Google's official gemini CLI (OAuth
|
||||
login, mounted ~/.gemini); the same guards apply. V1: delivery
|
||||
roles only — not available for Intake/Secretary.
|
||||
</p>
|
||||
) : null}
|
||||
</section>
|
||||
|
||||
{/* -------- Self-Hosted model picker (when self_hosted mode active) -------- */}
|
||||
@@ -953,178 +1161,58 @@ export function AIRoutingCard() {
|
||||
</div>
|
||||
) : (
|
||||
<div className="divide-y rounded-md border">
|
||||
{agentGroups.map((group) => (
|
||||
<div key={group.title} className="p-4">
|
||||
<HelpTip label={group.titleHint}>
|
||||
<h4 className="mb-2 w-fit text-xs font-semibold text-muted-foreground uppercase tracking-wider">
|
||||
{group.title}
|
||||
</h4>
|
||||
</HelpTip>
|
||||
<div className="grid grid-cols-1 gap-x-8 gap-y-3 sm:grid-cols-2">
|
||||
{group.agents.map((a) => (
|
||||
<div
|
||||
key={a.id}
|
||||
className="grid grid-cols-[1fr_170px] items-center gap-4 rounded-md border px-3 py-2.5"
|
||||
>
|
||||
<div className="min-w-0">
|
||||
<div className="truncate font-mono text-xs">
|
||||
{a.id}
|
||||
</div>
|
||||
<div className="truncate text-[11px] text-muted-foreground">
|
||||
{a.name}
|
||||
</div>
|
||||
</div>
|
||||
<Select
|
||||
value={mixMap[a.id] ?? ""}
|
||||
onValueChange={(v: string) =>
|
||||
setMixMap((prev) => ({
|
||||
...prev,
|
||||
[a.id]: v === "__clear__" ? "" : v,
|
||||
}))
|
||||
}
|
||||
{agentGroups.map((group) => {
|
||||
const restrictInteractiveOnly =
|
||||
group.title === INTERACTIVE_ONLY_GROUP_TITLE;
|
||||
return (
|
||||
<div key={group.title} className="p-4">
|
||||
<HelpTip label={group.titleHint}>
|
||||
<h4 className="mb-2 w-fit text-xs font-semibold text-muted-foreground uppercase tracking-wider">
|
||||
{group.title}
|
||||
</h4>
|
||||
</HelpTip>
|
||||
{restrictInteractiveOnly ? (
|
||||
<p className="mb-2 text-[11px] text-muted-foreground">
|
||||
Codex and Gemini are delivery-roles-only (V1) — not
|
||||
offered here (no interactive Intake/Secretary support).
|
||||
</p>
|
||||
) : null}
|
||||
<div className="grid grid-cols-1 gap-x-8 gap-y-3 sm:grid-cols-2">
|
||||
{group.agents.map((a) => (
|
||||
<div
|
||||
key={a.id}
|
||||
className="grid grid-cols-[1fr_170px] items-center gap-4 rounded-md border px-3 py-2.5"
|
||||
>
|
||||
<SelectTrigger size="sm" className="w-full text-xs">
|
||||
<SelectValue placeholder="(inherit)" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="__clear__">
|
||||
(inherit global)
|
||||
</SelectItem>
|
||||
|
||||
{/* Anthropic models */}
|
||||
{catalogAnthropicOnly.length > 0 && (
|
||||
<SelectGroup>
|
||||
<SelectLabel>
|
||||
<ProviderBadge variant="anthropic" />
|
||||
Anthropic
|
||||
</SelectLabel>
|
||||
{catalogAnthropicOnly.map(
|
||||
(c: {
|
||||
model_name: string;
|
||||
display_name: string;
|
||||
}) => (
|
||||
<SelectItem
|
||||
key={c.model_name}
|
||||
value={c.model_name}
|
||||
>
|
||||
{c.display_name}
|
||||
</SelectItem>
|
||||
),
|
||||
)}
|
||||
</SelectGroup>
|
||||
)}
|
||||
|
||||
{/* Grok (xAI) models */}
|
||||
{catalogGrokOnly.length > 0 && (
|
||||
<SelectGroup>
|
||||
<SelectLabel>
|
||||
<ProviderBadge variant="grok" />
|
||||
Grok (xAI)
|
||||
</SelectLabel>
|
||||
{catalogGrokOnly.map(
|
||||
(c: {
|
||||
model_name: string;
|
||||
display_name: string;
|
||||
}) => (
|
||||
<SelectItem
|
||||
key={c.model_name}
|
||||
value={c.model_name}
|
||||
>
|
||||
{c.display_name}
|
||||
</SelectItem>
|
||||
),
|
||||
)}
|
||||
</SelectGroup>
|
||||
)}
|
||||
|
||||
{/* Codex (OpenAI) models */}
|
||||
{catalogOpenaiOnly.length > 0 && (
|
||||
<SelectGroup>
|
||||
<SelectLabel>
|
||||
<ProviderBadge variant="openai" />
|
||||
Codex (OpenAI)
|
||||
</SelectLabel>
|
||||
{catalogOpenaiOnly.map(
|
||||
(c: {
|
||||
model_name: string;
|
||||
display_name: string;
|
||||
}) => (
|
||||
<SelectItem
|
||||
key={c.model_name}
|
||||
value={c.model_name}
|
||||
>
|
||||
{c.display_name}
|
||||
</SelectItem>
|
||||
),
|
||||
)}
|
||||
</SelectGroup>
|
||||
)}
|
||||
|
||||
{/* Ollama Cloud models */}
|
||||
{catalogOllamaOnly.length > 0 && (
|
||||
<SelectGroup>
|
||||
<SelectLabel>
|
||||
<ProviderBadge variant="ollama" />
|
||||
Ollama Cloud
|
||||
</SelectLabel>
|
||||
{catalogOllamaOnly.map(
|
||||
(c: {
|
||||
model_name: string;
|
||||
display_name: string;
|
||||
}) => (
|
||||
<SelectItem
|
||||
key={c.model_name}
|
||||
value={c.model_name}
|
||||
>
|
||||
{c.display_name}
|
||||
</SelectItem>
|
||||
),
|
||||
)}
|
||||
</SelectGroup>
|
||||
)}
|
||||
|
||||
{/* Self-Hosted models */}
|
||||
{selfHostedModels.length > 0 && (
|
||||
<SelectGroup>
|
||||
<SelectLabel>
|
||||
<ProviderBadge variant="self-hosted" />
|
||||
Self-Hosted
|
||||
</SelectLabel>
|
||||
{selfHostedModels.map((m: SelfHostedModel) => (
|
||||
<SelectItem
|
||||
key={m.model_name}
|
||||
value={m.model_name}
|
||||
>
|
||||
{m.display_name}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectGroup>
|
||||
)}
|
||||
|
||||
{/* Fallback: un-grouped catalog when no grouping is possible */}
|
||||
{catalogAnthropicOnly.length === 0 &&
|
||||
catalogOllamaOnly.length === 0 &&
|
||||
selfHostedModels.length === 0 &&
|
||||
catalogForMix.map(
|
||||
(c: {
|
||||
model_name: string;
|
||||
display_name: string;
|
||||
}) => (
|
||||
<SelectItem
|
||||
key={c.model_name}
|
||||
value={c.model_name}
|
||||
>
|
||||
{c.display_name} — {c.model_name}
|
||||
</SelectItem>
|
||||
),
|
||||
)}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
))}
|
||||
<div className="min-w-0">
|
||||
<div className="truncate font-mono text-xs">
|
||||
{a.id}
|
||||
</div>
|
||||
<div className="truncate text-[11px] text-muted-foreground">
|
||||
{a.name}
|
||||
</div>
|
||||
</div>
|
||||
<Select
|
||||
value={mixMap[a.id] ?? ""}
|
||||
onValueChange={(v: string) =>
|
||||
setMixMap((prev) => ({
|
||||
...prev,
|
||||
[a.id]: v === "__clear__" ? "" : v,
|
||||
}))
|
||||
}
|
||||
>
|
||||
<SelectTrigger size="sm" className="w-full text-xs">
|
||||
<SelectValue placeholder="(inherit)" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{renderMixSelectOptions(restrictInteractiveOnly)}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
{catalogOllamaOnly.length === 0 ? (
|
||||
@@ -1274,7 +1362,13 @@ function errMsg(e: unknown): string {
|
||||
function ProviderBadge({
|
||||
variant,
|
||||
}: {
|
||||
variant: "anthropic" | "grok" | "openai" | "ollama" | "self-hosted";
|
||||
variant:
|
||||
| "anthropic"
|
||||
| "grok"
|
||||
| "openai"
|
||||
| "gemini"
|
||||
| "ollama"
|
||||
| "self-hosted";
|
||||
}) {
|
||||
const styles: Record<string, string> = {
|
||||
anthropic: "bg-blue-500/20 text-blue-700 dark:text-blue-400",
|
||||
@@ -1282,6 +1376,7 @@ function ProviderBadge({
|
||||
"self-hosted": "bg-purple-500/20 text-purple-700 dark:text-purple-400",
|
||||
grok: "bg-teal-500/20 text-teal-700 dark:text-teal-400",
|
||||
openai: "bg-emerald-500/20 text-emerald-700 dark:text-emerald-400",
|
||||
gemini: "bg-sky-500/20 text-sky-700 dark:text-sky-400",
|
||||
};
|
||||
const labels: Record<string, string> = {
|
||||
anthropic: "A",
|
||||
@@ -1289,6 +1384,7 @@ function ProviderBadge({
|
||||
"self-hosted": "S",
|
||||
grok: "G",
|
||||
openai: "C",
|
||||
gemini: "Ge",
|
||||
};
|
||||
return (
|
||||
<span
|
||||
|
||||
Reference in New Issue
Block a user