Files
gemini-cli/packages/cli/src/ui/components/InputPrompt.tsx
T

42 lines
959 B
TypeScript
Raw Normal View History

/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
2025-04-15 21:41:08 -07:00
import React from 'react';
import { Box, Text } from 'ink';
import TextInput from 'ink-text-input';
import { globalConfig } from '../../config/config.js';
2025-04-15 21:41:08 -07:00
interface InputPromptProps {
2025-04-17 18:06:21 -04:00
query: string;
setQuery: (value: string) => void;
onSubmit: (value: string) => void;
isActive: boolean;
2025-04-15 21:41:08 -07:00
}
2025-04-18 19:09:41 -04:00
export const InputPrompt: React.FC<InputPromptProps> = ({
2025-04-17 18:06:21 -04:00
query,
setQuery,
onSubmit,
2025-04-15 21:41:08 -07:00
}) => {
const model = globalConfig.getModel();
2025-04-17 18:06:21 -04:00
return (
<Box marginTop={1} borderStyle="round" borderColor={'white'} paddingX={1}>
<Text color={'white'}>&gt; </Text>
<Box flexGrow={1}>
<TextInput
value={query}
onChange={setQuery}
onSubmit={onSubmit}
showCursor={true}
focus={true}
placeholder={`Ask Gemini (${model})... (try "/init" or "/help")`}
2025-04-17 18:06:21 -04:00
/>
</Box>
</Box>
);
2025-04-18 18:08:43 -04:00
};