-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModelCustomDownloadView.tsx
More file actions
68 lines (59 loc) · 1.59 KB
/
ModelCustomDownloadView.tsx
File metadata and controls
68 lines (59 loc) · 1.59 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import { Box, Text } from 'ink';
import { ExitHint } from '@/components';
import { UI } from '@/constants';
import type { ThemeDefinition } from '@/types';
import { TextInput } from '../TextInput';
import { ModelSuggestions } from './ModelSuggestions';
import type { Notice } from './types';
import { getNoticeColor } from './utils';
interface Props {
downloadDraft: string;
notice: Notice | null;
theme: ThemeDefinition;
onDraftChange: (value: string) => void;
onHighlight: (value: string | null) => void;
onSelectSuggestion: (value: string) => void;
onSubmit: (value: string) => void;
}
export function ModelCustomDownloadView({
downloadDraft,
notice,
theme,
onDraftChange,
onHighlight,
onSelectSuggestion,
onSubmit,
}: Props) {
const renderNotice = () =>
notice ? (
<Text color={getNoticeColor(notice.tone, theme)}>{notice.text}</Text>
) : null;
return (
<Box flexDirection="column">
<Text>Enter an Ollama model name to download.</Text>
<Box>
<Text>{UI.PROMPT_PREFIX}</Text>
<TextInput
value={downloadDraft}
placeholder="name:tag"
wrapIndent={UI.PROMPT_PREFIX.length}
onChange={onDraftChange}
onSubmit={onSubmit}
/>
</Box>
<ModelSuggestions
catalog={[]}
input={downloadDraft}
onHighlight={onHighlight}
onSelect={onSelectSuggestion}
/>
{renderNotice()}
<Text>
<Text color={theme.colors.secondary} dimColor>
Press Enter to download.
</Text>{' '}
<ExitHint />
</Text>
</Box>
);
}