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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
// Write a component that displays a dialog box with a text field and a button.
import React, { useEffect, useState } from "react";
import styled from "styled-components";
import { Button, secondaryDark, vscBackground, vscForeground } from ".";
import { isMetaEquivalentKeyPressed } from "../util";
import { ReactMarkdown } from "react-markdown/lib/react-markdown";
const ScreenCover = styled.div`
position: fixed;
width: 100%;
height: 100%;
background-color: rgba(168, 168, 168, 0.5);
z-index: 100;
`;
const DialogContainer = styled.div`
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 75%;
`;
const Dialog = styled.div`
color: ${vscForeground};
background-color: ${vscBackground};
border-radius: 8px;
display: flex;
flex-direction: column;
box-shadow: 0 0 10px 0 ${vscForeground};
margin: auto;
word-wrap: break-word;
overflow: hidden;
`;
const TextArea = styled.textarea`
border: 1px solid #ccc;
border-radius: 8px;
padding: 8px;
outline: 1px solid black;
resize: none;
background-color: ${secondaryDark};
color: ${vscForeground};
&:focus {
outline: 1px solid ${vscForeground};
}
`;
const P = styled.p`
color: ${vscForeground};
margin: 8px auto;
`;
const TextDialog = (props: {
showDialog: boolean;
onEnter: () => void;
onClose: () => void;
message?: string | JSX.Element;
}) => {
useEffect(() => {
const handleKeyDown = (event: KeyboardEvent) => {
if (event.key === "Escape") {
props.onClose();
}
};
document.addEventListener("keydown", handleKeyDown);
return () => {
document.removeEventListener("keydown", handleKeyDown);
};
}, [props]);
return (
<ScreenCover
onClick={() => {
props.onClose();
}}
hidden={!props.showDialog}
>
<DialogContainer
onClick={(e) => {
e.stopPropagation();
}}
>
<Dialog>
{typeof props.message === "string" &&
props.message.includes("Continue uses GPT-4") ? (
<div>
<p>
Continue uses GPT-4 by default, but works with any model. If
you'd like to keep your code completely private, there are few
options:
</p>
<p>
Run a local model with ggml:{" "}
<a
href="https://github.com/continuedev/ggml-server-example"
target="_blank"
>
5 minute quickstart
</a>
</p>
<p>
Use Azure OpenAI service, which is GDPR and HIPAA compliant:
<a
href="https://continue.dev/docs/customization#azure-openai-service"
target="_blank"
>
Tutorial
</a>
</p>
<p>
If you already have an LLM deployed on your own infrastructure,
or would like to do so, please contact us at hi@continue.dev.
</p>
</div>
) : typeof props.message === "string" ? (
<ReactMarkdown>{props.message || ""}</ReactMarkdown>
) : (
props.message
)}
</Dialog>
</DialogContainer>
</ScreenCover>
);
};
export default TextDialog;
|