summaryrefslogtreecommitdiff
path: root/packages/cli/src/ui/components/InputPrompt.tsx
blob: 3b6b10b185d086b54f28d0d2d23423928fe574a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */

import React from 'react';
import { Box, Text } from 'ink';
import TextInput from 'ink-text-input';
import { globalConfig } from '../../config/config.js';

interface InputPromptProps {
  query: string;
  setQuery: (value: string) => void;
  onSubmit: (value: string) => void;
  isActive: boolean;
}

export const InputPrompt: React.FC<InputPromptProps> = ({
  query,
  setQuery,
  onSubmit,
}) => {
  const model = globalConfig.getModel();

  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")`}
        />
      </Box>
    </Box>
  );
};