Skip to content

The agent that grows with you

fix(dashboard): show the slot model as current in aux/MoA pickers

xxxigm5146a0187799
diff --git a/web/src/components/ModelPickerDialog.tsx b/web/src/components/ModelPickerDialog.tsx
index 44e5de48440..2bca8f3bdbe 100644
--- a/web/src/components/ModelPickerDialog.tsx
+++ b/web/src/components/ModelPickerDialog.tsx
@@ -15,6 +15,12 @@ import { cn, themedBody } from "@/lib/utils";
import { queryMatchesProviderOnly } from "@/lib/model-picker-filter";
import { fuzzyRank, modelSearchText } from "@hermes/shared";
import { errorMessage } from "@/lib/api-error";
+import {
+ formatPickerCurrentLabel,
+ isAutoPickerCurrent,
+ resolveInitialProviderSlug,
+ resolvePickerCurrent,
+} from "@/lib/model-picker-current";
/**
* Two-stage model picker modal.
@@ -75,6 +81,12 @@ interface Props {
title?: string;
/** If true, hides "Persist globally" checkbox — always saves to config.yaml. */
alwaysGlobal?: boolean;
+ /**
+ * Current assignment for this picker *slot* (auxiliary task, MoA model).
+ * The options loader always returns the main chat model; without this,
+ * "Set Auxiliary: Vision" shows `current: glm-5.3` while Vision is Qwen.
+ */
+ currentAssignment?: { model?: string; provider?: string } | null;
}
export function ModelPickerDialog(props: Props) {
@@ -87,6 +99,7 @@ export function ModelPickerDialog(props: Props) {
onClose,
title = "Switch Model",
alwaysGlobal = false,
+ currentAssignment,
} = props;
const standalone = !!loader && !!onApply;
@@ -107,12 +120,13 @@ export function ModelPickerDialog(props: Props) {
const applyOptions = (r: ModelOptionsResult) => {
const next = r?.providers ?? [];
+ const current = resolvePickerCurrent(r, currentAssignment);
setProviders(next);
- setCurrentModel(String(r?.model ?? ""));
- setCurrentProviderSlug(String(r?.provider ?? ""));
+ setCurrentModel(current.model);
+ setCurrentProviderSlug(current.provider);
setSelectedSlug((prev) => {
if (prev && next.some((p) => p.slug === prev)) return prev;
- return (next.find((p) => p.is_current) ?? next[0])?.slug ?? "";
+ return resolveInitialProviderSlug(next, current.provider);
});
setSelectedModel("");
};
@@ -363,8 +377,11 @@ export function ModelPickerDialog(props: Props) {
{title}
</h2>
<p className="text-xs text-muted-foreground mt-1 font-mono">
- current: {currentModel || "(unknown)"}
- {currentProviderSlug && ` · ${currentProviderSlug}`}
+ current:{" "}
+ {formatPickerCurrentLabel({
+ model: currentModel,
+ provider: currentProviderSlug,
+ })}
</p>
</header>
@@ -389,6 +406,7 @@ export function ModelPickerDialog(props: Props) {
providers={filteredProviders}
total={providers.length}
selectedSlug={selectedSlug}
+ currentProviderSlug={currentProviderSlug}
query={trimmedQuery}
onSelect={(slug) => {
setSelectedSlug(slug);
@@ -493,6 +511,7 @@ function ProviderColumn({
providers,
total,
selectedSlug,
+ currentProviderSlug,
query,
onSelect,
onClose,
@@ -502,6 +521,7 @@ function ProviderColumn({
providers: ModelOptionProvider[];
total: number;
selectedSlug: string;
+ currentProviderSlug: string;
query: string;
onSelect(slug: string): void;
/** The links below navigate away; the full-screen dialog must close or it keeps covering the target page. */
@@ -539,6 +559,9 @@ function ProviderColumn({
{providers.map((p) => {
const active = p.slug === selectedSlug;
+ const isCurrentProvider =
+ p.slug === currentProviderSlug &&
+ !isAutoPickerCurrent({ model: "", provider: currentProviderSlug });
return (
<ListItem
key={p.slug}
@@ -551,7 +574,7 @@ function ProviderColumn({
<div className="flex-1 min-w-0">
<div className="flex items-center gap-1.5">
<span className="font-medium truncate">{p.name}</span>
- {p.is_current && <CurrentTag />}
+ {isCurrentProvider && <CurrentTag />}
</div>
<div className="text-xs text-text-secondary font-mono truncate">
{p.slug} · {p.total_models ?? p.models?.length ?? 0} models
diff --git a/web/src/lib/model-picker-current.ts b/web/src/lib/model-picker-current.ts
new file mode 100644
index 00000000000..6e156f3e603
--- /dev/null
+++ b/web/src/lib/model-picker-current.ts
@@ -0,0 +1,71 @@
+/**
+ * Resolve what the dashboard model picker should treat as "current".
+ *
+ * `/api/model/options` always returns the *main* chat model. Auxiliary and
+ * MoA pickers reuse that catalog, so they must pass the slot assignment or
+ * the header/highlight will show GLM (or whatever the chat model is) while
+ * the task list shows the real Vision/MoA pin.
+ */
+
+export interface PickerCurrent {
+ model: string;
+ provider: string;
+}
+
+export function isAutoPickerCurrent(current: PickerCurrent): boolean {
+ const provider = current.provider.trim().toLowerCase();
+ return !provider || provider === "auto";
+}
+
+/** Map an auxiliary-task row onto picker current. Auto/empty → auto. */
+export function assignmentToPickerCurrent(
+ assignment: { model?: string; provider?: string } | null | undefined,
+): PickerCurrent {
+ const provider = String(assignment?.provider ?? "").trim();
+ const model = String(assignment?.model ?? "").trim();
+ if (!provider || provider.toLowerCase() === "auto") {
+ return { model: "", provider: "auto" };
+ }
+ return { model, provider };
+}
+
+/**
+ * `override` wins when the picker is for a non-main slot. Missing override
+ * keeps the catalog's main model (chat-session / Set Main Model).
+ */
+export function resolvePickerCurrent(
+ options: { model?: string; provider?: string } | null | undefined,
+ override?: { model?: string; provider?: string } | null,
+): PickerCurrent {
+ if (override) {
+ return {
+ model: String(override.model ?? ""),
+ provider: String(override.provider ?? ""),
+ };
+ }
+ return {
+ model: String(options?.model ?? ""),
+ provider: String(options?.provider ?? ""),
+ };
+}
+
+export function formatPickerCurrentLabel(current: PickerCurrent): string {
+ if (isAutoPickerCurrent(current)) {
+ return "auto (use main model)";
+ }
+ const model = current.model.trim() || "(unknown)";
+ const provider = current.provider.trim();
+ return provider ? `${model} · ${provider}` : model;
+}
+
+export function resolveInitialProviderSlug(
+ providers: readonly { slug: string; is_current?: boolean | null }[],
+ currentProvider: string,
+): string {
+ const slug = currentProvider.trim();
+ if (slug && slug.toLowerCase() !== "auto") {
+ const match = providers.find((p) => p.slug === slug);
+ if (match) return match.slug;
+ }
+ return (providers.find((p) => p.is_current) ?? providers[0])?.slug ?? "";
+}
diff --git a/web/src/pages/ModelsPage.tsx b/web/src/pages/ModelsPage.tsx
index e9a2fb55913..c4dd0a0c780 100644
--- a/web/src/pages/ModelsPage.tsx
+++ b/web/src/pages/ModelsPage.tsx
@@ -43,6 +43,7 @@ import { PluginSlot } from "@/plugins";
import { ModelPickerDialog } from "@/components/ModelPickerDialog";
import { ModelReloadConfirm } from "@/components/ModelReloadConfirm";
import { errorMessage } from "@/lib/api-error";
+import { assignmentToPickerCurrent } from "@/lib/model-picker-current";
const PERIODS = [
{ label: "7d", days: 7 },
@@ -668,6 +669,9 @@ function AuxiliaryTasksModal({
key={`picker-${refreshKey}`}
loader={api.getModelOptions}
alwaysGlobal
+ currentAssignment={assignmentToPickerCurrent(
+ aux?.tasks.find((a) => a.task === picker.task),
+ )}
title={`Set Auxiliary: ${
AUX_TASKS.find((t) => t.key === picker.task)?.label ??
picker.task
@@ -905,6 +909,11 @@ function MoaModelsModal({
key={`moa-picker-${refreshKey}-${selected}-${picker.kind}-${picker.kind === "reference" ? picker.index : "agg"}`}
loader={api.getModelOptions}
alwaysGlobal
+ currentAssignment={
+ picker.kind === "aggregator"
+ ? preset.aggregator
+ : preset.reference_models[picker.index]
+ }
title="Select MoA Model"
onApply={async ({ provider, model }) => {
if ((provider || "").toLowerCase() === "moa") {