Merge branch 'pe/onboarding-refactor' of https://github.com/continuedev/continue into pe/onboarding-refactor
This commit is contained in:
commit
4de67f30d6
2 changed files with 0 additions and 156 deletions
|
|
@ -1,72 +0,0 @@
|
|||
import React, { useContext } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import styled from "styled-components";
|
||||
import { Button, Input } from "..";
|
||||
import { IdeMessengerContext } from "../../context/IdeMessenger";
|
||||
import { setDefaultModel } from "../../redux/slices/stateSlice";
|
||||
import { setShowDialog } from "../../redux/slices/uiStateSlice";
|
||||
import { FREE_TRIAL_LIMIT_REQUESTS } from "../../util/freeTrial";
|
||||
|
||||
const GridDiv = styled.div`
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
grid-gap: 8px;
|
||||
align-items: center;
|
||||
`;
|
||||
|
||||
export const ftl = () => {
|
||||
// const ftc = parseInt(localStorage.getItem("ftc"));
|
||||
return 50;
|
||||
};
|
||||
|
||||
function FTCDialog() {
|
||||
const navigate = useNavigate();
|
||||
const [apiKey, setApiKey] = React.useState("");
|
||||
const dispatch = useDispatch();
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
|
||||
return (
|
||||
<div className="p-4">
|
||||
<h3>Free Trial Limit Reached</h3>
|
||||
<p>
|
||||
You've reached the free trial limit of {FREE_TRIAL_LIMIT_REQUESTS} free
|
||||
inputs. 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://docs.continue.dev/setup/overview" target="_blank">
|
||||
documentation
|
||||
</a>
|
||||
.
|
||||
</p>
|
||||
|
||||
<Input
|
||||
type="text"
|
||||
placeholder="Enter your OpenAI API key"
|
||||
value={apiKey}
|
||||
onChange={(e) => setApiKey(e.target.value)}
|
||||
/>
|
||||
<GridDiv>
|
||||
<Button
|
||||
onClick={() => {
|
||||
dispatch(setShowDialog(false));
|
||||
navigate("/models");
|
||||
}}
|
||||
>
|
||||
Select model
|
||||
</Button>
|
||||
<Button
|
||||
disabled={!apiKey}
|
||||
onClick={() => {
|
||||
ideMessenger.post("config/addOpenAiKey", apiKey);
|
||||
dispatch(setShowDialog(false));
|
||||
dispatch(setDefaultModel({ title: "GPT-4" }));
|
||||
}}
|
||||
>
|
||||
Use my API key
|
||||
</Button>
|
||||
</GridDiv>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default FTCDialog;
|
||||
|
|
@ -1,84 +0,0 @@
|
|||
import React, { useContext } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import styled from "styled-components";
|
||||
import { Button, Input } from "..";
|
||||
import { IdeMessengerContext } from "../../context/IdeMessenger";
|
||||
import { setDefaultModel } from "../../redux/slices/stateSlice";
|
||||
import { setShowDialog } from "../../redux/slices/uiStateSlice";
|
||||
import { useOnboardingCard } from "../OnboardingCard";
|
||||
|
||||
const GridDiv = styled.div`
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
grid-gap: 8px;
|
||||
align-items: center;
|
||||
`;
|
||||
|
||||
function SetupLocalOrKeyDialog() {
|
||||
const navigate = useNavigate();
|
||||
const [apiKey, setApiKey] = React.useState("");
|
||||
const dispatch = useDispatch();
|
||||
const onboardingCard = useOnboardingCard();
|
||||
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
|
||||
function onClickLocal() {
|
||||
dispatch(setShowDialog(false));
|
||||
onboardingCard.open("Local");
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="p-4">
|
||||
<h3>Set up your own model</h3>
|
||||
<p>
|
||||
To keep using Continue after your free inputs, you can either use your
|
||||
own API key, or use a local LLM. To read more about the options, see our{" "}
|
||||
<a
|
||||
className="cursor-pointer"
|
||||
onClick={() =>
|
||||
ideMessenger.request(
|
||||
"openUrl",
|
||||
"https://docs.continue.dev/reference/Model%20Providers/freetrial",
|
||||
)
|
||||
}
|
||||
>
|
||||
documentation
|
||||
</a>
|
||||
.
|
||||
</p>
|
||||
|
||||
<Input
|
||||
type="text"
|
||||
placeholder="Enter your OpenAI API key"
|
||||
value={apiKey}
|
||||
onChange={(e) => setApiKey(e.target.value)}
|
||||
/>
|
||||
<Button
|
||||
className="w-full"
|
||||
disabled={!apiKey}
|
||||
onClick={() => {
|
||||
ideMessenger.post("config/addOpenAiKey", apiKey);
|
||||
dispatch(setShowDialog(false));
|
||||
dispatch(setDefaultModel({ title: "GPT-4" }));
|
||||
}}
|
||||
>
|
||||
Use my OpenAI API key
|
||||
</Button>
|
||||
<div className="text-center">— OR —</div>
|
||||
<GridDiv>
|
||||
<Button onClick={onClickLocal}>Use local model</Button>
|
||||
<Button
|
||||
onClick={() => {
|
||||
dispatch(setShowDialog(false));
|
||||
navigate("/models");
|
||||
}}
|
||||
>
|
||||
View all options
|
||||
</Button>
|
||||
</GridDiv>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default SetupLocalOrKeyDialog;
|
||||
Loading…
Add table
Reference in a new issue