From dbeda91ec440e832e17802801b0bb211b218af74 Mon Sep 17 00:00:00 2001 From: Adam Weidman <65992621+adamfweidman@users.noreply.github.com> Date: Tue, 16 Dec 2025 14:22:13 -0500 Subject: [PATCH] feat: update to match mocks (#89) --- packages/cli/src/ui/components/Footer.tsx | 1 + .../src/ui/components/ProQuotaDialog.test.tsx | 47 +------------------ .../cli/src/ui/components/ProQuotaDialog.tsx | 35 ++++++++------ .../__snapshots__/Footer.test.tsx.snap | 4 +- .../src/ui/hooks/useQuotaAndFallback.test.ts | 2 +- .../cli/src/ui/hooks/useQuotaAndFallback.ts | 8 +++- packages/core/src/config/models.ts | 16 ++++--- 7 files changed, 42 insertions(+), 71 deletions(-) diff --git a/packages/cli/src/ui/components/Footer.tsx b/packages/cli/src/ui/components/Footer.tsx index 5192461c43..358342faa1 100644 --- a/packages/cli/src/ui/components/Footer.tsx +++ b/packages/cli/src/ui/components/Footer.tsx @@ -150,6 +150,7 @@ export const Footer: React.FC = () => { {getDisplayString(model, config.getPreviewFeatures())} + /model {!hideContextPercentage && ( <> {' '} diff --git a/packages/cli/src/ui/components/ProQuotaDialog.test.tsx b/packages/cli/src/ui/components/ProQuotaDialog.test.tsx index 2bf83a6067..42746678e2 100644 --- a/packages/cli/src/ui/components/ProQuotaDialog.test.tsx +++ b/packages/cli/src/ui/components/ProQuotaDialog.test.tsx @@ -169,7 +169,7 @@ describe('ProQuotaDialog', () => { }); describe('when it is a capacity error', () => { - it('should render keep trying, switch, and stop options', () => { + it('should render keep trying and stop options', () => { const { unmount } = render( { value: 'retry_once', key: 'retry_once', }, - { - label: 'Switch to gemini-2.5-flash', - value: 'retry_always', - key: 'retry_always', - }, { label: 'Stop', value: 'retry_later', key: 'retry_later' }, ], }), @@ -295,44 +290,4 @@ describe('ProQuotaDialog', () => { unmount(); }); }); - - describe('footer note', () => { - it('should show a special note for PREVIEW_GEMINI_MODEL', () => { - const { lastFrame, unmount } = render( - , - ); - - const output = lastFrame(); - expect(output).toContain( - 'Note: We will periodically retry Preview Model to see if congestion has cleared.', - ); - unmount(); - }); - - it('should show the default note for other models', () => { - const { lastFrame, unmount } = render( - , - ); - - const output = lastFrame(); - expect(output).toContain( - 'Note: You can always use /model to select a different option.', - ); - unmount(); - }); - }); }); diff --git a/packages/cli/src/ui/components/ProQuotaDialog.tsx b/packages/cli/src/ui/components/ProQuotaDialog.tsx index 88351a425b..cda3937a7f 100644 --- a/packages/cli/src/ui/components/ProQuotaDialog.tsx +++ b/packages/cli/src/ui/components/ProQuotaDialog.tsx @@ -9,7 +9,7 @@ import { Box, Text } from 'ink'; import { RadioButtonSelect } from './shared/RadioButtonSelect.js'; import { theme } from '../semantic-colors.js'; -import { DEFAULT_GEMINI_MODEL, UserTierId } from '@google/gemini-cli-core'; +import { UserTierId } from '@google/gemini-cli-core'; interface ProQuotaDialogProps { failedModel: string; @@ -91,11 +91,6 @@ export function ProQuotaDialog({ value: 'retry_once' as const, key: 'retry_once', }, - { - label: `Switch to ${fallbackModel}`, - value: 'retry_always' as const, - key: 'retry_always', - }, { label: 'Stop', value: 'retry_later' as const, @@ -110,19 +105,31 @@ export function ProQuotaDialog({ onChoice(choice); }; + // Helper to highlight simple slash commands in the message + const renderMessage = (msg: string) => { + const parts = msg.split(/(\s+)/); + return ( + + {parts.map((part, index) => { + if (part.startsWith('/')) { + return ( + + {part} + + ); + } + return {part}; + })} + + ); + }; + return ( - - {message} - + {renderMessage(message)} - - {fallbackModel === DEFAULT_GEMINI_MODEL && !isModelNotFoundError - ? 'Note: We will periodically retry Preview Model to see if congestion has cleared.' - : 'Note: You can always use /model to select a different option.'} - ); } diff --git a/packages/cli/src/ui/components/__snapshots__/Footer.test.tsx.snap b/packages/cli/src/ui/components/__snapshots__/Footer.test.tsx.snap index 83c0fb0dba..be6f152e9f 100644 --- a/packages/cli/src/ui/components/__snapshots__/Footer.test.tsx.snap +++ b/packages/cli/src/ui/components/__snapshots__/Footer.test.tsx.snap @@ -1,8 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`