Skip to content

Commit 9ed41a1

Browse files
committed
feat(ui): show agent runtime distinction in model picker rows
1 parent 7ecdef6 commit 9ed41a1

4 files changed

Lines changed: 55 additions & 8 deletions

File tree

‎ui/src/pages/chat/chat-view.test.ts‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5196,6 +5196,40 @@ describe("chat model controls", () => {
51965196
expect(modelOption?.closest("openclaw-tooltip")).toBeNull();
51975197
});
51985198

5199+
it("distinguishes model rows that use different agent runtimes", () => {
5200+
const { state } = createChatHeaderState({
5201+
model: "gpt-5.6",
5202+
modelProvider: "openai",
5203+
models: [
5204+
{
5205+
id: "gpt-5.6",
5206+
name: "GPT-5.6",
5207+
provider: "openai",
5208+
contextWindow: 1_000_000,
5209+
agentRuntime: { id: "openclaw", source: "model" },
5210+
},
5211+
{
5212+
id: "gpt-5.6-sol",
5213+
name: "GPT-5.6 Sol",
5214+
provider: "openai",
5215+
contextWindow: 1_000_000,
5216+
agentRuntime: { id: "codex", source: "model" },
5217+
},
5218+
],
5219+
});
5220+
const container = renderModelControls(state);
5221+
const openClawMeta = container.querySelector(
5222+
'[data-chat-model-option="openai/gpt-5.6"] .chat-controls__model-option-meta',
5223+
);
5224+
const codexMeta = container.querySelector(
5225+
'[data-chat-model-option="openai/gpt-5.6-sol"] .chat-controls__model-option-meta',
5226+
);
5227+
5228+
expect(openClawMeta?.textContent).toBe("1M · OpenClaw");
5229+
expect(openClawMeta?.textContent).not.toContain("Codex");
5230+
expect(codexMeta?.textContent).toBe("1M · Codex");
5231+
});
5232+
51995233
it("marks chat-only models in the active control and picker", () => {
52005234
const { state } = createChatHeaderState({
52015235
model: "qwen3-8b",

‎ui/src/pages/chat/components/chat-model-controls.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,10 @@ export function renderChatModelControls(props: ChatModelControlsProps) {
200200
const isDefault =
201201
defaultSelectable && option.value.trim().toLowerCase() === normalizedDefaultModel;
202202
const catalogEntry = resolveChatModelCatalogEntry(option.value, props.modelCatalog);
203+
const agentRuntimeId = catalogEntry?.agentRuntime?.id.trim();
203204
return {
204205
commitValue: isDefault ? "" : option.value,
206+
...(agentRuntimeId ? { agentRuntimeId } : {}),
205207
...(catalogEntry?.contextWindow ? { contextWindow: catalogEntry.contextWindow } : {}),
206208
...(typeof catalogEntry?.supportsTools === "boolean"
207209
? { supportsTools: catalogEntry.supportsTools }

‎ui/src/pages/chat/components/chat-model-picker.ts‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export type ChatModelCatalogState = {
1717
};
1818

1919
export type ChatModelPickerOption = {
20+
agentRuntimeId?: string;
2021
commitValue: string;
2122
contextWindow?: number;
2223
isDefault: boolean;
@@ -26,6 +27,19 @@ export type ChatModelPickerOption = {
2627
value: string;
2728
};
2829

30+
const AGENT_RUNTIME_LABELS: Readonly<Record<string, string>> = {
31+
codex: "Codex",
32+
openclaw: "OpenClaw",
33+
};
34+
35+
function formatAgentRuntimeLabel(id: string): string {
36+
const normalized = id.trim().toLowerCase();
37+
return (
38+
AGENT_RUNTIME_LABELS[normalized] ??
39+
`${normalized.charAt(0).toUpperCase()}${normalized.slice(1)}`
40+
);
41+
}
42+
2943
type ChatModelPickerParams = {
3044
defaultModelLabel: string;
3145
disabled: boolean;
@@ -471,6 +485,9 @@ export function renderChatModelPicker(params: ChatModelPickerParams) {
471485
entry.supportsTools === false
472486
? t("chat.modelControls.chatOnly")
473487
: "",
488+
entry.agentRuntimeId
489+
? formatAgentRuntimeLabel(entry.agentRuntimeId)
490+
: "",
474491
]
475492
.filter(Boolean)
476493
.join(" · ");

‎ui/src/test-helpers/control-ui-e2e.ts‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import type { Locator, Page } from "playwright";
1010
import type { InlineConfig, Plugin, PreviewServer, ViteDevServer } from "vite";
1111
import { PROTOCOL_VERSION } from "../../../packages/gateway-protocol/src/version.js";
1212
import { CONTROL_UI_BOOTSTRAP_CONFIG_PATH } from "../../../src/gateway/control-ui-contract.js";
13+
import type { ModelCatalogEntry } from "../api/types.ts";
1314
import type { ControlUiBuildInfo } from "../build-info.ts";
1415

1516
export function controlUiSessionPath(sessionKey: string, basePath = ""): string {
@@ -245,14 +246,7 @@ export type ControlUiMockGatewayScenario = {
245246
sessionInfo?: Record<string, unknown> | null;
246247
/** Partition sessions.list fixtures by archived state after applying patches. */
247248
sessionArchiveFiltering?: boolean;
248-
models?: Array<{
249-
id: string;
250-
name: string;
251-
provider: string;
252-
available?: boolean;
253-
contextWindow?: number;
254-
supportsTools?: boolean;
255-
}>;
249+
models?: ModelCatalogEntry[];
256250
/** Operator scopes returned by the mocked connect handshake. */
257251
operatorScopes?: string[];
258252
sessionKey?: string;

0 commit comments

Comments
 (0)