/** * @license * Copyright 2025 Qwen * SPDX-License-Identifier: Apache-2.0 */ import type React from 'react'; import { Box, Text } from 'ink'; import { Colors } from '../colors.js'; import { RadioButtonSelect, type RadioSelectItem, } from './shared/RadioButtonSelect.js'; import { useKeypress } from '../hooks/useKeypress.js'; export enum VisionSwitchOutcome { SwitchOnce = 'switch_once', SwitchSessionToVL = 'switch_session_to_vl', DisallowWithGuidance = 'disallow_with_guidance', } export interface ModelSwitchDialogProps { onSelect: (outcome: VisionSwitchOutcome) => void; } export const ModelSwitchDialog: React.FC = ({ onSelect, }) => { useKeypress( (key) => { if (key.name === 'escape') { onSelect(VisionSwitchOutcome.DisallowWithGuidance); } }, { isActive: true }, ); const options: Array> = [ { label: 'Switch for this request only', value: VisionSwitchOutcome.SwitchOnce, }, { label: 'Switch session to vision model', value: VisionSwitchOutcome.SwitchSessionToVL, }, { label: 'Do not switch, show guidance', value: VisionSwitchOutcome.DisallowWithGuidance, }, ]; const handleSelect = (outcome: VisionSwitchOutcome) => { onSelect(outcome); }; return ( Vision Model Switch Required Your message contains an image, but the current model doesn't support vision. How would you like to proceed? Press Enter to select, Esc to cancel ); };