blob: 3ea753bcc73a903542f293712e9f696acd4a6130 (
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
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
|
import React, { useContext } from "react";
import styled from "styled-components";
import { Button, TextInput } from "..";
import { useNavigate } from "react-router-dom";
import { GUIClientContext } from "../../App";
import { useDispatch } from "react-redux";
import { setShowDialog } from "../../redux/slices/uiStateSlice";
const GridDiv = styled.div`
display: grid;
grid-template-columns: 1fr 1fr;
grid-gap: 8px;
align-items: center;
`;
function FTCDialog() {
const navigate = useNavigate();
const [apiKey, setApiKey] = React.useState("");
const client = useContext(GUIClientContext);
const dispatch = useDispatch();
return (
<div className="p-4">
<h3>Free Trial Limit Reached</h3>
<p>
You've reached the free trial limit of 250 free inputs with Continue's
OpenAI API key. To keep using Continue, you can either use your own API
key, or use a local LLM. To read more about the options, see our{" "}
<a
href="https://continue.dev/docs/customization/models"
target="_blank"
>
documentation
</a>
. If you're just looking for fastest way to keep going, type '/config'
to open your Continue config file and paste your API key into the
OpenAIFreeTrial object.
</p>
<TextInput
type="text"
placeholder="Enter your OpenAI API key"
value={apiKey}
onChange={(e) => setApiKey(e.target.value)}
/>
<GridDiv>
<Button
onClick={() => {
navigate("/models");
}}
>
Select model
</Button>
<Button
disabled={!apiKey}
onClick={() => {
client?.addModelForRole("*", "OpenAI", {
model: "gpt-4",
api_key: apiKey,
title: "GPT-4",
});
dispatch(setShowDialog(false));
}}
>
Use my API key
</Button>
</GridDiv>
</div>
);
}
export default FTCDialog;
|