mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
52 lines
1.2 KiB
TypeScript
52 lines
1.2 KiB
TypeScript
/**
|
|
* @license
|
|
* Copyright 2025 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
import { Box } from 'ink';
|
|
import { type ReactNode } from 'react';
|
|
import { theme } from '../semantic-colors.js';
|
|
import { MarkdownDisplay } from '../utils/MarkdownDisplay.js';
|
|
import { RadioButtonSelect } from './shared/RadioButtonSelect.js';
|
|
|
|
type ConsentPromptProps = {
|
|
// If a simple string is given, it will render using markdown by default.
|
|
prompt: ReactNode;
|
|
onConfirm: (value: boolean) => void;
|
|
terminalWidth: number;
|
|
};
|
|
|
|
export const ConsentPrompt = (props: ConsentPromptProps) => {
|
|
const { prompt, onConfirm, terminalWidth } = props;
|
|
|
|
return (
|
|
<Box
|
|
borderStyle="round"
|
|
borderColor={theme.border.default}
|
|
flexDirection="column"
|
|
paddingY={1}
|
|
paddingX={2}
|
|
>
|
|
{typeof prompt === 'string' ? (
|
|
<MarkdownDisplay
|
|
isPending={true}
|
|
text={prompt}
|
|
terminalWidth={terminalWidth}
|
|
/>
|
|
) : (
|
|
prompt
|
|
)}
|
|
<Box marginTop={1}>
|
|
<RadioButtonSelect
|
|
items={[
|
|
{ label: 'Yes', value: true, key: 'Yes' },
|
|
{ label: 'No', value: false, key: 'No' },
|
|
]}
|
|
onSelect={onConfirm}
|
|
/>
|
|
</Box>
|
|
</Box>
|
|
);
|
|
};
|