Skip to content

Commit a2981c8

Browse files
authored
fix(gui): render Claude helper model labels (lidge-jun#623)
Co-authored-by: hanbinnoh <282618027+hanbinnoh@users.noreply.github.com>
1 parent 75bd272 commit a2981c8

2 files changed

Lines changed: 32 additions & 1 deletion

File tree

gui/src/pages/ClaudeCode.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export default function ClaudeCode({ apiBase }: { apiBase: string }) {
6969
}, [load]);
7070

7171
const modelOptions = useMemo(() => {
72-
const options = (state?.available ?? []).map(m => ({ value: m, label: String(modelLabel(m)) }));
72+
const options = (state?.available ?? []).map(m => ({ value: m, label: modelLabel(m) }));
7373
return [{ value: "", label: t("claude.smallFastModelUnsetOption") }, ...options];
7474
}, [state?.available, t]);
7575

gui/tests/claudecode-fetch-errors.test.tsx

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,3 +172,34 @@ test("ClaudeCode save treats an empty 200 body as success", async () => {
172172
testWindow.close();
173173
}
174174
});
175+
176+
test("ClaudeCode helper model options render icon-backed model names", async () => {
177+
globalThis.fetch = (async (input) => {
178+
if (String(input).endsWith("/api/claude-code")) {
179+
return Response.json({ ...CLAUDE_OK, available: ["gpt-5.6-luna"] });
180+
}
181+
return new Response(null, { status: 404 });
182+
}) as typeof fetch;
183+
184+
const { container, root, testWindow } = await mountClaudeCode();
185+
try {
186+
const helperModel = container.querySelector<HTMLButtonElement>(
187+
'[role="combobox"][aria-label="Background helper model"]',
188+
);
189+
expect(helperModel).toBeTruthy();
190+
191+
await act(async () => {
192+
helperModel!.click();
193+
await Promise.resolve();
194+
});
195+
196+
const optionText = [...testWindow.document.querySelectorAll<HTMLElement>('[role="option"]')]
197+
.map(option => option.textContent)
198+
.join("\n");
199+
expect(optionText).toContain("gpt-5.6-luna");
200+
expect(optionText).not.toContain("[object Object]");
201+
} finally {
202+
await act(async () => root.unmount());
203+
testWindow.close();
204+
}
205+
});

0 commit comments

Comments
 (0)