2025-08-29 04:19:43 +05:30
|
|
|
/**
|
|
|
|
|
* @license
|
|
|
|
|
* Copyright 2025 Google LLC
|
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import type React from 'react';
|
|
|
|
|
import { Box, Text } from 'ink';
|
|
|
|
|
import { RadioButtonSelect } from './shared/RadioButtonSelect.js';
|
2025-09-10 10:57:07 -07:00
|
|
|
import { theme } from '../semantic-colors.js';
|
2025-08-29 04:19:43 +05:30
|
|
|
|
|
|
|
|
interface ProQuotaDialogProps {
|
|
|
|
|
fallbackModel: string;
|
2025-11-06 13:43:21 -05:00
|
|
|
onChoice: (choice: 'retry_later' | 'retry') => void;
|
2025-08-29 04:19:43 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function ProQuotaDialog({
|
|
|
|
|
fallbackModel,
|
|
|
|
|
onChoice,
|
|
|
|
|
}: ProQuotaDialogProps): React.JSX.Element {
|
|
|
|
|
const items = [
|
|
|
|
|
{
|
2025-11-06 13:43:21 -05:00
|
|
|
label: 'Try again later',
|
|
|
|
|
value: 'retry_later' as const,
|
|
|
|
|
key: 'retry_later',
|
2025-08-29 04:19:43 +05:30
|
|
|
},
|
|
|
|
|
{
|
2025-11-06 13:43:21 -05:00
|
|
|
label: `Switch to ${fallbackModel} for the rest of this session`,
|
|
|
|
|
value: 'retry' as const,
|
|
|
|
|
key: 'retry',
|
2025-08-29 04:19:43 +05:30
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
2025-11-06 13:43:21 -05:00
|
|
|
const handleSelect = (choice: 'retry_later' | 'retry') => {
|
2025-08-29 04:19:43 +05:30
|
|
|
onChoice(choice);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Box borderStyle="round" flexDirection="column" paddingX={1}>
|
2025-11-06 13:43:21 -05:00
|
|
|
<Box marginTop={1} marginBottom={1}>
|
2025-08-29 04:19:43 +05:30
|
|
|
<RadioButtonSelect
|
|
|
|
|
items={items}
|
|
|
|
|
initialIndex={1}
|
|
|
|
|
onSelect={handleSelect}
|
|
|
|
|
/>
|
|
|
|
|
</Box>
|
2025-11-06 13:43:21 -05:00
|
|
|
<Text color={theme.text.primary}>
|
|
|
|
|
Note: You can always use /model to select a different option.
|
|
|
|
|
</Text>
|
2025-08-29 04:19:43 +05:30
|
|
|
</Box>
|
|
|
|
|
);
|
|
|
|
|
}
|