Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions packages/cli/src/ui/components/ModelDialog.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,15 @@ describe('<ModelDialog />', () => {
unmount();
});

it('switches to "manual" view when "Manual" is selected', async () => {
it('switches to "manual" view when "Manual" is selected and uses getDisplayString for models', async () => {
mockGetDisplayString.mockImplementation((val: string) => {
if (val === DEFAULT_GEMINI_MODEL) return 'Formatted Pro Model';
if (val === DEFAULT_GEMINI_FLASH_MODEL) return 'Formatted Flash Model';
if (val === DEFAULT_GEMINI_FLASH_LITE_MODEL)
return 'Formatted Lite Model';
return val;
});

const { lastFrame, stdin, waitUntilReady, unmount } =
await renderComponent();

Expand All @@ -129,9 +137,9 @@ describe('<ModelDialog />', () => {
// Should now show manual options
await waitFor(() => {
const output = lastFrame();
expect(output).toContain(DEFAULT_GEMINI_MODEL);
expect(output).toContain(DEFAULT_GEMINI_FLASH_MODEL);
expect(output).toContain(DEFAULT_GEMINI_FLASH_LITE_MODEL);
expect(output).toContain('Formatted Pro Model');
expect(output).toContain('Formatted Flash Model');
expect(output).toContain('Formatted Lite Model');
});
unmount();
});
Expand Down Expand Up @@ -264,11 +272,16 @@ describe('<ModelDialog />', () => {
unmount();
});

it('shows the preferred manual model in the main view option', async () => {
it('shows the preferred manual model in the main view option using getDisplayString', async () => {
mockGetModel.mockReturnValue(DEFAULT_GEMINI_MODEL);
mockGetDisplayString.mockImplementation((val: string) => {
if (val === DEFAULT_GEMINI_MODEL) return 'My Custom Model Display';
if (val === 'auto-gemini-2.5') return 'Auto (Gemini 2.5)';
return val;
});
const { lastFrame, unmount } = await renderComponent();

expect(lastFrame()).toContain(`Manual (${DEFAULT_GEMINI_MODEL})`);
expect(lastFrame()).toContain('Manual (My Custom Model Display)');
unmount();
});

Expand Down
12 changes: 6 additions & 6 deletions packages/cli/src/ui/components/ModelDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
{
value: 'Manual',
title: manualModelSelected
? `Manual (${manualModelSelected})`
? `Manual (${getDisplayString(manualModelSelected)})`
Comment thread
sehoon38 marked this conversation as resolved.
: 'Manual',
description: 'Manually select a model',
key: 'Manual',
Expand All @@ -106,7 +106,7 @@
value: PREVIEW_GEMINI_MODEL_AUTO,
title: getDisplayString(PREVIEW_GEMINI_MODEL_AUTO),
description: useGemini31
? 'Let Gemini CLI decide the best model for the task: gemini-3.1-pro, gemini-3-flash'

Check warning on line 109 in packages/cli/src/ui/components/ModelDialog.tsx

View workflow job for this annotation

GitHub Actions / Lint

Found sensitive keyword "gemini-3.1". Please make sure this change is appropriate to submit.
: 'Let Gemini CLI decide the best model for the task: gemini-3-pro, gemini-3-flash',
key: PREVIEW_GEMINI_MODEL_AUTO,
});
Expand All @@ -118,17 +118,17 @@
const list = [
{
value: DEFAULT_GEMINI_MODEL,
title: DEFAULT_GEMINI_MODEL,
title: getDisplayString(DEFAULT_GEMINI_MODEL),
key: DEFAULT_GEMINI_MODEL,
},
{
value: DEFAULT_GEMINI_FLASH_MODEL,
title: DEFAULT_GEMINI_FLASH_MODEL,
title: getDisplayString(DEFAULT_GEMINI_FLASH_MODEL),
key: DEFAULT_GEMINI_FLASH_MODEL,
},
{
value: DEFAULT_GEMINI_FLASH_LITE_MODEL,
title: DEFAULT_GEMINI_FLASH_LITE_MODEL,
title: getDisplayString(DEFAULT_GEMINI_FLASH_LITE_MODEL),
key: DEFAULT_GEMINI_FLASH_LITE_MODEL,
},
];
Expand All @@ -145,12 +145,12 @@
list.unshift(
{
value: previewProValue,
title: previewProModel,
title: getDisplayString(previewProModel),
key: previewProModel,
},
{
value: PREVIEW_GEMINI_FLASH_MODEL,
title: PREVIEW_GEMINI_FLASH_MODEL,
title: getDisplayString(PREVIEW_GEMINI_FLASH_MODEL),
key: PREVIEW_GEMINI_FLASH_MODEL,
},
);
Expand Down
Loading