update config methods
This commit is contained in:
parent
444767801d
commit
92dbbd20d0
33 changed files with 458 additions and 348 deletions
|
|
@ -4,7 +4,11 @@ import { FREE_TRIAL_MODELS } from "./default.js";
|
|||
export const TRIAL_FIM_MODEL = "codestral-latest";
|
||||
export const ONBOARDING_LOCAL_MODEL_TITLE = "Ollama";
|
||||
|
||||
export function setupApiKeysMode(
|
||||
/**
|
||||
* We set the "best" chat + autocopmlete models by default
|
||||
* whenever a user doesn't have a config.json
|
||||
*/
|
||||
export function setupBestConfig(
|
||||
config: SerializedContinueConfig,
|
||||
): SerializedContinueConfig {
|
||||
return {
|
||||
|
|
@ -19,7 +23,7 @@ export function setupApiKeysMode(
|
|||
};
|
||||
}
|
||||
|
||||
export function setupLocalMode(
|
||||
export function setupLocalConfig(
|
||||
config: SerializedContinueConfig,
|
||||
): SerializedContinueConfig {
|
||||
return {
|
||||
|
|
@ -50,7 +54,7 @@ export function setupLocalMode(
|
|||
};
|
||||
}
|
||||
|
||||
export function setupFreeTrialMode(
|
||||
export function setupQuickstartConfig(
|
||||
config: SerializedContinueConfig,
|
||||
): SerializedContinueConfig {
|
||||
return {
|
||||
|
|
@ -73,7 +77,7 @@ export function setupFreeTrialMode(
|
|||
};
|
||||
}
|
||||
|
||||
export function setupLocalAfterFreeTrial(
|
||||
export function setupLocalConfigAfterFreeTrial(
|
||||
config: SerializedContinueConfig,
|
||||
): SerializedContinueConfig {
|
||||
return {
|
||||
|
|
|
|||
30
core/core.ts
30
core/core.ts
|
|
@ -3,10 +3,10 @@ import type { ContextItemId, IDE, IndexingProgressUpdate } from ".";
|
|||
import { CompletionProvider } from "./autocomplete/completionProvider";
|
||||
import { ConfigHandler } from "./config/ConfigHandler";
|
||||
import {
|
||||
setupApiKeysMode,
|
||||
setupFreeTrialMode,
|
||||
setupLocalAfterFreeTrial,
|
||||
setupLocalMode,
|
||||
setupBestConfig,
|
||||
setupQuickstartConfig,
|
||||
setupLocalConfigAfterFreeTrial,
|
||||
setupLocalConfig,
|
||||
} from "./config/onboarding";
|
||||
import { createNewPromptFile } from "./config/promptFile";
|
||||
import { addModel, addOpenAIKey, deleteModel } from "./config/util";
|
||||
|
|
@ -606,31 +606,27 @@ export class Core {
|
|||
on("completeOnboarding", (msg) => {
|
||||
const mode = msg.data.mode;
|
||||
|
||||
Telemetry.capture("onboardingSelection", {
|
||||
mode,
|
||||
});
|
||||
|
||||
if (mode === "custom") {
|
||||
if (mode === "Custom") {
|
||||
return;
|
||||
}
|
||||
|
||||
let editConfigJsonCallback: Parameters<typeof editConfigJson>[0];
|
||||
|
||||
switch (mode) {
|
||||
case "local":
|
||||
editConfigJsonCallback = setupLocalMode;
|
||||
case "Local":
|
||||
editConfigJsonCallback = setupLocalConfig;
|
||||
break;
|
||||
|
||||
case "freeTrial":
|
||||
editConfigJsonCallback = setupFreeTrialMode;
|
||||
case "Quickstart":
|
||||
editConfigJsonCallback = setupQuickstartConfig;
|
||||
break;
|
||||
|
||||
case "localAfterFreeTrial":
|
||||
editConfigJsonCallback = setupLocalAfterFreeTrial;
|
||||
case "LocalAfterFreeTrial":
|
||||
editConfigJsonCallback = setupLocalConfigAfterFreeTrial;
|
||||
break;
|
||||
|
||||
case "apiKeys":
|
||||
editConfigJsonCallback = setupApiKeysMode;
|
||||
case "Best":
|
||||
editConfigJsonCallback = setupBestConfig;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -22,6 +22,13 @@ export type ProtocolGeneratorType<T> = AsyncGenerator<{
|
|||
content: T;
|
||||
}>;
|
||||
|
||||
export type OnboardingModes =
|
||||
| "Local"
|
||||
| "Best"
|
||||
| "Custom"
|
||||
| "Quickstart"
|
||||
| "LocalAfterFreeTrial";
|
||||
|
||||
export interface ListHistoryOptions {
|
||||
offset?: number;
|
||||
limit?: number;
|
||||
|
|
@ -137,13 +144,7 @@ export type ToCoreFromIdeOrWebviewProtocol = {
|
|||
"index/indexingProgressBarInitialized": [undefined, void];
|
||||
completeOnboarding: [
|
||||
{
|
||||
mode:
|
||||
| "local"
|
||||
| "apiKeys"
|
||||
| "custom"
|
||||
| "freeTrial"
|
||||
| "localAfterFreeTrial"
|
||||
| "bestExperience";
|
||||
mode: OnboardingModes;
|
||||
},
|
||||
void,
|
||||
];
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ export type ToWebviewFromIdeProtocol = ToWebviewFromIdeOrCoreProtocol & {
|
|||
setColors: [{ [key: string]: string }, void];
|
||||
"jetbrains/editorInsetRefresh": [undefined, void];
|
||||
addApiKey: [undefined, void];
|
||||
setupLocalModel: [undefined, void];
|
||||
setupLocalConfig: [undefined, void];
|
||||
incrementFtc: [undefined, void];
|
||||
openOnboarding: [undefined, void];
|
||||
openOnboardingCard: [undefined, void];
|
||||
};
|
||||
|
|
|
|||
|
|
@ -634,7 +634,7 @@ class IdeProtocolClient (
|
|||
|
||||
if (ghAuthToken == null) {
|
||||
// Open a dialog so user can enter their GitHub token
|
||||
continuePluginService.sendToWebview("openOnboarding", null, uuid())
|
||||
continuePluginService.sendToWebview("openOnboardingCard", null, uuid())
|
||||
respond(null)
|
||||
} else {
|
||||
respond(ghAuthToken)
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ class VsCodeIde implements IDE {
|
|||
"continue.continueGUIView.focus",
|
||||
);
|
||||
(await this.vscodeWebviewProtocolPromise).request(
|
||||
"openOnboarding",
|
||||
"openOnboardingCard",
|
||||
undefined,
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ export class ContinueCompletionProvider
|
|||
showFreeTrialLoginMessage(
|
||||
e.message,
|
||||
this.configHandler.reloadConfig.bind(this.configHandler),
|
||||
() => this.webviewProtocol.request("openOnboarding", undefined),
|
||||
() => this.webviewProtocol.request("openOnboardingCard", undefined),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
|
@ -50,7 +50,7 @@ export class ContinueCompletionProvider
|
|||
),
|
||||
);
|
||||
} else if (val === "Download Ollama") {
|
||||
vscode.env.openExternal(vscode.Uri.parse("https://ollama.ai"));
|
||||
vscode.env.openExternal(vscode.Uri.parse("https://ollama.ai/download"));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import * as vscode from "vscode";
|
|||
export function showFreeTrialLoginMessage(
|
||||
message: string,
|
||||
reloadConfig: () => void,
|
||||
openOnboarding: () => void,
|
||||
openOnboardingCard: () => void,
|
||||
) {
|
||||
vscode.window
|
||||
.showInformationMessage(message, "Sign In", "Use API key / local model")
|
||||
|
|
@ -17,7 +17,7 @@ export function showFreeTrialLoginMessage(
|
|||
reloadConfig();
|
||||
});
|
||||
} else if (selection === "Use API key / local model") {
|
||||
openOnboarding();
|
||||
openOnboardingCard();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -137,12 +137,12 @@ export class VsCodeWebviewProtocol
|
|||
if (selection === "Add API Key") {
|
||||
this.request("addApiKey", undefined);
|
||||
} else if (selection === "Use Local Model") {
|
||||
this.request("setupLocalModel", undefined);
|
||||
this.request("setupLocalConfig", undefined);
|
||||
}
|
||||
});
|
||||
} else if (message.includes("Please sign in with GitHub")) {
|
||||
showFreeTrialLoginMessage(message, this.reloadConfig, () =>
|
||||
this.request("openOnboarding", undefined),
|
||||
this.request("openOnboardingCard", undefined),
|
||||
);
|
||||
} else {
|
||||
Telemetry.capture(
|
||||
|
|
|
|||
|
|
@ -17,10 +17,15 @@ export default function ContinueLogo({
|
|||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
d="M199.142 100.633L191.304 114.263L211.044 148.774C211.334 149.065 211.334 149.355 211.334 149.645C211.334 149.935 211.334 150.225 211.044 150.515L191.304 185.026L199.142 198.656L227.3 149.645L199.142 100.633ZM188.401 112.523L196.239 98.8928H180.563L172.725 112.523H188.401ZM172.435 116.003L190.723 147.904H206.399L188.111 116.003H172.435ZM188.401 182.996L206.689 151.095H191.014L172.725 182.996H188.401ZM172.435 186.766L180.273 200.396H195.949L188.111 186.766H172.435ZM119.311 203.586C119.021 203.586 118.73 203.586 118.44 203.296C118.15 203.006 117.859 203.006 117.859 202.716L97.8292 168.205H82.1533L110.312 217.217H166.919L159.081 203.586H119.311ZM161.984 201.846L169.822 215.477L177.66 201.846L169.822 188.216L161.984 201.846ZM166.919 186.476H130.052L122.214 200.106H158.791L166.919 186.476ZM127.149 184.736L108.86 152.835L101.022 166.465L119.311 198.366L127.149 184.736ZM82.1533 164.725H97.8292L105.667 151.095H89.9913L82.1533 164.725ZM117.569 96.5728C117.569 96.2827 117.859 95.9927 118.15 95.9927C118.44 95.9927 118.73 95.7027 119.021 95.7027H158.791L166.629 82.0723H110.312L82.1533 131.084H97.8292L117.569 96.5728ZM105.667 148.194L97.8292 134.564H82.1533L89.9913 148.194H105.667ZM119.021 100.923L100.732 132.824L108.57 146.454L126.859 114.553L119.021 100.923ZM159.081 99.1828H122.214L130.052 112.813H166.919L159.081 99.1828ZM169.822 111.073L177.66 97.4428L169.822 83.8123L161.984 97.4428L169.822 111.073Z"
|
||||
fill={vscForeground}
|
||||
/>
|
||||
<g
|
||||
className="origin-center animate-spin-slow"
|
||||
style={{ transformOrigin: "150px 150px" }}
|
||||
>
|
||||
<path
|
||||
d="M199.142 100.633L191.304 114.263L211.044 148.774C211.334 149.065 211.334 149.355 211.334 149.645C211.334 149.935 211.334 150.225 211.044 150.515L191.304 185.026L199.142 198.656L227.3 149.645L199.142 100.633ZM188.401 112.523L196.239 98.8928H180.563L172.725 112.523H188.401ZM172.435 116.003L190.723 147.904H206.399L188.111 116.003H172.435ZM188.401 182.996L206.689 151.095H191.014L172.725 182.996H188.401ZM172.435 186.766L180.273 200.396H195.949L188.111 186.766H172.435ZM119.311 203.586C119.021 203.586 118.73 203.586 118.44 203.296C118.15 203.006 117.859 203.006 117.859 202.716L97.8292 168.205H82.1533L110.312 217.217H166.919L159.081 203.586H119.311ZM161.984 201.846L169.822 215.477L177.66 201.846L169.822 188.216L161.984 201.846ZM166.919 186.476H130.052L122.214 200.106H158.791L166.919 186.476ZM127.149 184.736L108.86 152.835L101.022 166.465L119.311 198.366L127.149 184.736ZM82.1533 164.725H97.8292L105.667 151.095H89.9913L82.1533 164.725ZM117.569 96.5728C117.569 96.2827 117.859 95.9927 118.15 95.9927C118.44 95.9927 118.73 95.7027 119.021 95.7027H158.791L166.629 82.0723H110.312L82.1533 131.084H97.8292L117.569 96.5728ZM105.667 148.194L97.8292 134.564H82.1533L89.9913 148.194H105.667ZM119.021 100.923L100.732 132.824L108.57 146.454L126.859 114.553L119.021 100.923ZM159.081 99.1828H122.214L130.052 112.813H166.919L159.081 99.1828ZM169.822 111.073L177.66 97.4428L169.822 83.8123L161.984 97.4428L169.822 111.073Z"
|
||||
fill={vscForeground}
|
||||
/>
|
||||
</g>
|
||||
<path
|
||||
d="M512.369 123.254C501.918 123.254 493.5 128.184 487.984 136.884H486.533V126.154H473.76V203.587H486.533V158.345C486.533 144.715 497.854 134.854 510.917 134.854C523.981 134.854 532.109 144.425 532.109 157.475V203.877H544.882V157.475C544.592 137.754 532.109 123.254 512.369 123.254Z"
|
||||
fill={vscForeground}
|
||||
|
|
|
|||
|
|
@ -172,22 +172,6 @@ const Layout = () => {
|
|||
[location, navigate],
|
||||
);
|
||||
|
||||
useWebviewListener(
|
||||
"addApiKey",
|
||||
async () => {
|
||||
dispatch(setOnboardingCard({ show: true, activeTab: "Best" }));
|
||||
},
|
||||
[],
|
||||
);
|
||||
|
||||
useWebviewListener(
|
||||
"openOnboarding",
|
||||
async () => {
|
||||
dispatch(setOnboardingCard({ show: true, activeTab: "Quickstart" }));
|
||||
},
|
||||
[],
|
||||
);
|
||||
|
||||
useWebviewListener(
|
||||
"incrementFtc",
|
||||
async () => {
|
||||
|
|
@ -202,11 +186,18 @@ const Layout = () => {
|
|||
);
|
||||
|
||||
useWebviewListener(
|
||||
"setupLocalModel",
|
||||
"openOnboardingCard",
|
||||
async () => {
|
||||
ideMessenger.post("completeOnboarding", {
|
||||
mode: "localAfterFreeTrial",
|
||||
});
|
||||
navigate("/");
|
||||
dispatch(setOnboardingCard({ show: true, activeTab: "Best" }));
|
||||
},
|
||||
[],
|
||||
);
|
||||
|
||||
useWebviewListener(
|
||||
"setupLocalConfig",
|
||||
async () => {
|
||||
navigate("/");
|
||||
dispatch(setOnboardingCard({ show: true, activeTab: "Local" }));
|
||||
},
|
||||
[navigate],
|
||||
|
|
|
|||
|
|
@ -3,9 +3,15 @@ import * as Tabs from "./tabs";
|
|||
import OnboardingCardTabs, { TabTitle } from "./components/OnboardingCardTabs";
|
||||
import { XMarkIcon } from "@heroicons/react/24/outline";
|
||||
import styled from "styled-components";
|
||||
import { defaultBorderRadius, lightGray, vscInputBackground } from "../";
|
||||
import {
|
||||
CloseButton,
|
||||
defaultBorderRadius,
|
||||
lightGray,
|
||||
vscInputBackground,
|
||||
} from "../";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { setOnboardingCard } from "../../redux/slices/uiStateSlice";
|
||||
import { getLocalStorage, setLocalStorage } from "../../util/localStorage";
|
||||
|
||||
const StyledCard = styled.div`
|
||||
margin: auto;
|
||||
|
|
@ -16,20 +22,6 @@ const StyledCard = styled.div`
|
|||
0 8px 10px -6px rgb(0 0 0 / 0.1);
|
||||
`;
|
||||
|
||||
const CloseButton = styled.button`
|
||||
border: none;
|
||||
background-color: inherit;
|
||||
color: ${lightGray};
|
||||
position: absolute;
|
||||
top: 0.6rem;
|
||||
right: 1rem;
|
||||
padding: 0.25rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
`;
|
||||
|
||||
export interface OnboardingCardState {
|
||||
show?: boolean;
|
||||
activeTab?: TabTitle;
|
||||
|
|
@ -44,9 +36,8 @@ export type OnboardingCardProps = Pick<OnboardingCardState, "activeTab">;
|
|||
|
||||
function OnboardingCard(props: OnboardingCardProps) {
|
||||
const dispatch = useDispatch();
|
||||
// TODO: Verify this works elsewhere with hasPassedFTL logic
|
||||
const [activeTab, setActiveTab] = useState<TabTitle>(
|
||||
props.activeTab ?? "Quickstart",
|
||||
props.activeTab ?? "Best",
|
||||
);
|
||||
|
||||
function handleTabClick(tabName) {
|
||||
|
|
@ -54,10 +45,11 @@ function OnboardingCard(props: OnboardingCardProps) {
|
|||
}
|
||||
|
||||
function handleClose() {
|
||||
setLocalStorage("hasDismissedOnboardingCard", true);
|
||||
dispatch(setOnboardingCard({ show: false }));
|
||||
}
|
||||
|
||||
const renderTabContent = () => {
|
||||
function renderTabContent() {
|
||||
switch (activeTab) {
|
||||
case "Quickstart":
|
||||
return <Tabs.Quickstart />;
|
||||
|
|
@ -68,7 +60,11 @@ function OnboardingCard(props: OnboardingCardProps) {
|
|||
default:
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
if (getLocalStorage("onboardingStatus") === undefined) {
|
||||
setLocalStorage("onboardingStatus", "Started");
|
||||
}
|
||||
|
||||
return (
|
||||
<StyledCard className="relative">
|
||||
|
|
|
|||
|
|
@ -56,19 +56,21 @@ function BestExperienceConfigForm({
|
|||
|
||||
return (
|
||||
<form onSubmit={handleSubmit}>
|
||||
<div className="flex flex-col">
|
||||
<div className="flex flex-col gap-3">
|
||||
<div>
|
||||
<p className="text-lg font-bold leading-tight mb-2 flex flex-row justify-between gap-4 mb-2">
|
||||
Chat model
|
||||
<span
|
||||
<div className="text-lg font-bold mb-1 flex flex-row justify-between gap-4">
|
||||
<label className="text-lg font-bold">Chat model</label>
|
||||
<div
|
||||
className="flex items-center text-xs font-semibold"
|
||||
style={{ color: lightGray }}
|
||||
>
|
||||
<CubeIcon className="w-4 h-4 mr-1 flex-shrink-0 " />
|
||||
<span className="italic">{chatModel.title} </span>
|
||||
<span>by Anthropic</span>
|
||||
</span>
|
||||
</p>
|
||||
<CubeIcon className="w-4 h-4 mr-1 flex-shrink-0" />
|
||||
<span className="italic text-right">
|
||||
{chatModel.title}{" "}
|
||||
<span className="max-xs:hidden">by Anthropic</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col pb-4 w-full">
|
||||
<Input
|
||||
|
|
@ -90,19 +92,19 @@ function BestExperienceConfigForm({
|
|||
</div>
|
||||
|
||||
<div>
|
||||
<p className="text-lg font-bold leading-tight mb-2 flex flex-row justify-between gap-4 mb-2">
|
||||
Autocomplete model
|
||||
<span
|
||||
className="flex items-center font-semibold"
|
||||
<div className="text-lg font-bold mb-1 flex flex-row justify-between gap-4">
|
||||
<label className="text-lg font-bold">Autocomplete model</label>
|
||||
<div
|
||||
className="flex items-center text-xs font-semibold"
|
||||
style={{ color: lightGray }}
|
||||
>
|
||||
<CubeIcon className="w-4 h-4 mr-1 flex-shrink-0" />
|
||||
<span className="text-xs">
|
||||
<span className="italic">{autocompleteModel.title} </span>
|
||||
<span>by Mistral</span>
|
||||
<span className="italic text-right">
|
||||
{autocompleteModel.title}{" "}
|
||||
<span className="max-xs:hidden">by Mistral</span>
|
||||
</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col pb-4 w-full">
|
||||
<Input
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
import { CheckCircleIcon } from "@heroicons/react/24/solid";
|
||||
|
||||
interface OllamaCompletedStepProps {
|
||||
text: string;
|
||||
}
|
||||
|
||||
function OllamaCompletedStep({ text }: OllamaCompletedStepProps) {
|
||||
return (
|
||||
<div className="flex justify-between items-center">
|
||||
<p className="text-sm w-3/4 font-mono">{text}</p>
|
||||
<CheckCircleIcon width={24} height={24} className="text-emerald-600" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default OllamaCompletedStep;
|
||||
|
|
@ -1,8 +1,9 @@
|
|||
import { CheckCircleIcon, CommandLineIcon } from "@heroicons/react/24/outline";
|
||||
import { CommandLineIcon } from "@heroicons/react/24/outline";
|
||||
import { useContext } from "react";
|
||||
import { IdeMessengerContext } from "../../../context/IdeMessenger";
|
||||
import ReactDOM from "react-dom";
|
||||
import { StyledLinkButton, StyledTooltip } from "../..";
|
||||
import { StyledActionButton, StyledTooltip } from "../..";
|
||||
import OllamaCompletedStep from "./OllamaCompletedStep";
|
||||
|
||||
interface OllamaModelDownloadProps {
|
||||
title: string;
|
||||
|
|
@ -28,27 +29,23 @@ function OllamaModelDownload({
|
|||
return (
|
||||
<div className="flex flex-col">
|
||||
<p className="text-lg font-bold leading-tight mb-2">{title}</p>
|
||||
<>
|
||||
<StyledLinkButton data-tooltip-id={id} onClick={onClick}>
|
||||
<p className="font-mono">{command}</p>
|
||||
{hasDownloaded ? (
|
||||
<CheckCircleIcon
|
||||
width={24}
|
||||
height={24}
|
||||
className="text-emerald-600"
|
||||
/>
|
||||
) : (
|
||||
{hasDownloaded ? (
|
||||
<OllamaCompletedStep text={command} />
|
||||
) : (
|
||||
<>
|
||||
<StyledActionButton data-tooltip-id={id} onClick={onClick}>
|
||||
<p className="font-mono">{command}</p>
|
||||
<CommandLineIcon width={24} height={24} />
|
||||
)}
|
||||
</StyledLinkButton>
|
||||
{tooltipPortalDiv &&
|
||||
ReactDOM.createPortal(
|
||||
<StyledTooltip id={id} place="top">
|
||||
Copy into terminal
|
||||
</StyledTooltip>,
|
||||
tooltipPortalDiv,
|
||||
)}
|
||||
</>
|
||||
</StyledActionButton>
|
||||
{tooltipPortalDiv &&
|
||||
ReactDOM.createPortal(
|
||||
<StyledTooltip id={id} place="top">
|
||||
Copy into terminal
|
||||
</StyledTooltip>,
|
||||
tooltipPortalDiv,
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@ import { useState, useContext } from "react";
|
|||
import { IdeMessengerContext } from "../../../context/IdeMessenger";
|
||||
import { providers } from "../../../pages/AddNewModel/configs/providers";
|
||||
import { useCheckOllamaModels } from "../hooks/useCheckOllamaModels";
|
||||
import { StyledLinkButton } from "../..";
|
||||
import { StyledActionButton } from "../..";
|
||||
import OllamaCompletedStep from "./OllamaCompletedStep";
|
||||
|
||||
export enum OllamaConnectionStatuses {
|
||||
WaitingToDownload = "WaitingToDownload",
|
||||
|
|
@ -43,32 +44,23 @@ function OllamaStatus({ onConnectionVerified }: OllamaStatusProps) {
|
|||
switch (status) {
|
||||
case OllamaConnectionStatuses.WaitingToDownload:
|
||||
return (
|
||||
<StyledLinkButton onClick={onClickDownload}>
|
||||
<StyledActionButton onClick={onClickDownload}>
|
||||
<p className="underline text-sm">{downloadUrl}</p>
|
||||
<ArrowTopRightOnSquareIcon width={24} height={24} />
|
||||
</StyledLinkButton>
|
||||
</StyledActionButton>
|
||||
);
|
||||
case OllamaConnectionStatuses.Downloading:
|
||||
return (
|
||||
<div className="flex justify-between items-center ">
|
||||
<p className="text-sm w-3/4">
|
||||
<div className="flex justify-between items-center">
|
||||
<p className="text-sm w-3/4 font-mono">
|
||||
Checking for connection to Ollama at http://localhost:11434
|
||||
</p>
|
||||
<ArrowPathIcon className="h-4 w-4 animate-spin-slow" />
|
||||
<ArrowPathIcon className="h-4 w-4 animate-spin-slow mr-1" />
|
||||
</div>
|
||||
);
|
||||
case OllamaConnectionStatuses.Verified:
|
||||
return (
|
||||
<div className="flex justify-between items-center">
|
||||
<p className="text-sm w-3/4">
|
||||
Ollama is running at http://localhost:11434
|
||||
</p>
|
||||
<CheckCircleIcon
|
||||
width="24px"
|
||||
height="24px"
|
||||
className="text-emerald-600"
|
||||
/>
|
||||
</div>
|
||||
<OllamaCompletedStep text="Ollama is running at http://localhost:11434" />
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,32 +5,34 @@ import {
|
|||
} from "../../../redux/slices/uiStateSlice";
|
||||
import Alert from "../../gui/Alert";
|
||||
import AddModelForm from "../../../forms/AddModelForm";
|
||||
import { useCompleteOnboarding } from "../hooks";
|
||||
import { useSubmitOnboarding } from "../hooks";
|
||||
|
||||
function ProviderAlert() {
|
||||
const dispatch = useDispatch();
|
||||
const { completeOnboarding } = useCompleteOnboarding();
|
||||
const { submitOnboarding } = useSubmitOnboarding("Custom");
|
||||
|
||||
function onClick() {
|
||||
dispatch(setShowDialog(true));
|
||||
dispatch(setDialogMessage(<AddModelForm onDone={completeOnboarding} />));
|
||||
dispatch(setDialogMessage(<AddModelForm onDone={submitOnboarding} />));
|
||||
}
|
||||
|
||||
return (
|
||||
<Alert type="info">
|
||||
<p className="font-semibold text-sm m-0">
|
||||
Prefer to use an different provider like OpenAI?
|
||||
</p>
|
||||
<p className="m-0 mt-1">
|
||||
<a
|
||||
className="text-inherit underline cursor-pointer hover:text-inherit"
|
||||
onClick={onClick}
|
||||
>
|
||||
Click here
|
||||
</a>{" "}
|
||||
to add a Chat model from OpenAI, Gemini, and more
|
||||
</p>
|
||||
</Alert>
|
||||
<div className="max-xs:hidden">
|
||||
<Alert type="info">
|
||||
<p className="font-semibold text-sm m-0">
|
||||
Prefer to use an different provider like OpenAI?
|
||||
</p>
|
||||
<p className="m-0 mt-1">
|
||||
<a
|
||||
className="text-inherit underline cursor-pointer hover:text-inherit"
|
||||
onClick={onClick}
|
||||
>
|
||||
Click here
|
||||
</a>{" "}
|
||||
to add a Chat model from OpenAI, Gemini, and more
|
||||
</p>
|
||||
</Alert>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,82 +1,60 @@
|
|||
import { useContext, useState } from "react";
|
||||
import { Button, ButtonSubtext, Divider, Input, SecondaryButton } from "../..";
|
||||
import { useContext } from "react";
|
||||
import { Button, ButtonSubtext } from "../..";
|
||||
import { IdeMessengerContext } from "../../../context/IdeMessenger";
|
||||
import { isJetBrains } from "../../../util";
|
||||
import { setLocalStorage } from "../../../util/localStorage";
|
||||
import { useDispatch } from "react-redux";
|
||||
import {
|
||||
setDialogMessage,
|
||||
setShowDialog,
|
||||
} from "../../../redux/slices/uiStateSlice";
|
||||
import JetBrainsFetchGitHubTokenDialog from "../../dialogs/JetBrainsFetchGitHubTokenDialog";
|
||||
import { useSubmitOnboarding } from "../hooks";
|
||||
|
||||
interface QuickstartSubmitButtonProps {
|
||||
onComplete: (token: string) => void;
|
||||
}
|
||||
|
||||
function QuickstartSubmitButton({ onComplete }: QuickstartSubmitButtonProps) {
|
||||
function QuickstartSubmitButton() {
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
const [jbGhAuthToken, setJbGhAuthToken] = useState("");
|
||||
const [showJetBrainsInput, setShowJetBrainsInput] = useState(false);
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const handleTokenAcquisition = async (token: string) => {
|
||||
const { submitOnboarding } = useSubmitOnboarding("Quickstart");
|
||||
|
||||
function handleTokenAcquisition(token: string) {
|
||||
setLocalStorage("signedInToGh", true);
|
||||
onComplete(token);
|
||||
};
|
||||
submitOnboarding();
|
||||
}
|
||||
|
||||
const openGitHubTokenPage = () => {
|
||||
ideMessenger.post(
|
||||
"openUrl",
|
||||
"https://github.com/settings/tokens/new?scopes=user:email&description=Continue%20Free%20Trial%20Token%20",
|
||||
function openJetBrainsDialog() {
|
||||
dispatch(setShowDialog(true));
|
||||
dispatch(
|
||||
setDialogMessage(
|
||||
<JetBrainsFetchGitHubTokenDialog onComplete={handleTokenAcquisition} />,
|
||||
),
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
const getGitHubAuthToken = async () => {
|
||||
if (isJetBrains()) {
|
||||
setShowJetBrainsInput(true);
|
||||
} else {
|
||||
const result = await ideMessenger.request(
|
||||
"getGitHubAuthToken",
|
||||
undefined,
|
||||
);
|
||||
if (result.status === "success") {
|
||||
handleTokenAcquisition(result.content);
|
||||
}
|
||||
async function fetchGitHubAuthToken() {
|
||||
const result = await ideMessenger.request("getGitHubAuthToken", undefined);
|
||||
if (result.status === "success") {
|
||||
handleTokenAcquisition(result.content);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const submitJetBrainsToken = async () => {
|
||||
await ideMessenger.request("setGitHubAuthToken", { token: jbGhAuthToken });
|
||||
handleTokenAcquisition(jbGhAuthToken);
|
||||
};
|
||||
async function onClick() {
|
||||
if (isJetBrains()) {
|
||||
openJetBrainsDialog();
|
||||
} else {
|
||||
await fetchGitHubAuthToken();
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="mt-4 w-full">
|
||||
<Button
|
||||
onClick={getGitHubAuthToken}
|
||||
onClick={onClick}
|
||||
className="grid grid-flow-col items-center gap-2 w-full"
|
||||
>
|
||||
Get started using our API keys
|
||||
</Button>
|
||||
<ButtonSubtext>Try 50 chat and 2k autocomplete requests</ButtonSubtext>
|
||||
|
||||
{showJetBrainsInput && isJetBrains() && (
|
||||
<>
|
||||
<Divider className="my-8" />
|
||||
|
||||
<div className="flex justify-center mb-2">
|
||||
<SecondaryButton onClick={openGitHubTokenPage}>
|
||||
Get GitHub Token
|
||||
</SecondaryButton>
|
||||
</div>
|
||||
<Input
|
||||
placeholder="Paste token here"
|
||||
value={jbGhAuthToken}
|
||||
onChange={(e) => setJbGhAuthToken(e.target.value)}
|
||||
/>
|
||||
<Button
|
||||
onClick={submitJetBrainsToken}
|
||||
disabled={!jbGhAuthToken}
|
||||
className="grid grid-flow-col items-center gap-2 w-full mt-2"
|
||||
>
|
||||
Submit Token
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
export * from "./useCheckOllamaModels";
|
||||
export * from "./useCompleteOnboarding";
|
||||
export * from "./useSubmitOnboarding";
|
||||
|
|
|
|||
|
|
@ -4,23 +4,37 @@ import { useDispatch } from "react-redux";
|
|||
import { IdeMessengerContext } from "../../../context/IdeMessenger";
|
||||
import { setOnboardingCard } from "../../../redux/slices/uiStateSlice";
|
||||
import { getLocalStorage, setLocalStorage } from "../../../util/localStorage";
|
||||
import { OnboardingModes } from "core/protocol/core";
|
||||
import { useTutorialCard } from "../../../hooks/useTutorialCard";
|
||||
|
||||
export function useCompleteOnboarding() {
|
||||
export function useSubmitOnboarding(mode: OnboardingModes) {
|
||||
const posthog = usePostHog();
|
||||
const dispatch = useDispatch();
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
const { openTutorialCard } = useTutorialCard();
|
||||
|
||||
function completeOnboarding() {
|
||||
function submitOnboarding() {
|
||||
debugger;
|
||||
const onboardingStatus = getLocalStorage("onboardingStatus");
|
||||
|
||||
// Always close the onboarding card and update config.json
|
||||
dispatch(setOnboardingCard({ show: false }));
|
||||
ideMessenger.post("completeOnboarding", {
|
||||
mode,
|
||||
});
|
||||
|
||||
if (onboardingStatus === "Started") {
|
||||
// Telemetry
|
||||
posthog.capture("Onboarding Step", { status: "Completed" });
|
||||
posthog.capture("onboardingSelection", {
|
||||
mode,
|
||||
});
|
||||
|
||||
// Local state
|
||||
setLocalStorage("onboardingStatus", "Completed");
|
||||
setLocalStorage("showTutorialCard", true);
|
||||
dispatch(setOnboardingCard({ show: false }));
|
||||
|
||||
// Show tutorial card
|
||||
openTutorialCard();
|
||||
|
||||
// Move to next step in onboarding
|
||||
ideMessenger.post("showTutorial", undefined);
|
||||
|
|
@ -28,6 +42,6 @@ export function useCompleteOnboarding() {
|
|||
}
|
||||
|
||||
return {
|
||||
completeOnboarding,
|
||||
submitOnboarding,
|
||||
};
|
||||
}
|
||||
|
|
@ -1,14 +1,14 @@
|
|||
import BestExperienceConfigForm from "../components/BestExperienceConfigForm";
|
||||
import ProviderAlert from "../components/ProviderAlert";
|
||||
import { useCompleteOnboarding } from "../hooks";
|
||||
import { useSubmitOnboarding } from "../hooks";
|
||||
|
||||
function OnboardingBestTab() {
|
||||
const { completeOnboarding } = useCompleteOnboarding();
|
||||
const { submitOnboarding } = useSubmitOnboarding("Best");
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-4">
|
||||
<div className="flex flex-col gap-8">
|
||||
<ProviderAlert />
|
||||
<BestExperienceConfigForm onComplete={completeOnboarding} />
|
||||
<BestExperienceConfigForm onComplete={submitOnboarding} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,16 +3,19 @@ import { useContext, useEffect, useState } from "react";
|
|||
import { IdeMessengerContext } from "../../../context/IdeMessenger";
|
||||
import { Button } from "../..";
|
||||
import OllamaStatus from "../components/OllamaStatus";
|
||||
import { useCompleteOnboarding, useCheckOllamaModels } from "../hooks";
|
||||
import { useSubmitOnboarding, useCheckOllamaModels } from "../hooks";
|
||||
import OllamaModelDownload from "../components/OllamaModelDownload";
|
||||
import AddModelButtonSubtext from "../../AddModelButtonSubtext";
|
||||
import { hasPassedFTL } from "../../../util/freeTrial";
|
||||
|
||||
const autocompleteModel = "starcoder2:3b";
|
||||
const chatModel = "llama3.1";
|
||||
const chatModel = "llama3.1:8b";
|
||||
|
||||
function OnboardingLocalTab() {
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
const { completeOnboarding } = useCompleteOnboarding();
|
||||
const { submitOnboarding } = useSubmitOnboarding(
|
||||
hasPassedFTL() ? "LocalAfterFreeTrial" : "Local",
|
||||
);
|
||||
const [hasLoadedChatModel, setHasLoadedChatModel] = useState(false);
|
||||
const [downloadedOllamaModels, setDownloadedOllamaModels] = useState<
|
||||
string[]
|
||||
|
|
@ -73,7 +76,7 @@ function OnboardingLocalTab() {
|
|||
|
||||
<div className="mt-4 w-full">
|
||||
<Button
|
||||
onClick={completeOnboarding}
|
||||
onClick={submitOnboarding}
|
||||
className="w-full"
|
||||
disabled={!hasDownloadedChatModel}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -1,10 +1,7 @@
|
|||
import ContinueLogo from "../../ContinueLogo";
|
||||
import QuickStartSubmitButton from "../components/QuickStartSubmitButton";
|
||||
import { useCompleteOnboarding } from "../hooks";
|
||||
|
||||
function OnboardingQuickstartTab() {
|
||||
const { completeOnboarding } = useCompleteOnboarding();
|
||||
|
||||
return (
|
||||
<div className="flex justify-center items-center">
|
||||
<div className="flex flex-col items-center justify-center w-3/4 text-center">
|
||||
|
|
@ -21,7 +18,7 @@ function OnboardingQuickstartTab() {
|
|||
To prevent abuse, we'll ask you to sign in to GitHub.
|
||||
</p>
|
||||
|
||||
<QuickStartSubmitButton onComplete={completeOnboarding} />
|
||||
<QuickStartSubmitButton />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,73 @@
|
|||
import { ArrowTopRightOnSquareIcon } from "@heroicons/react/24/outline";
|
||||
import { useContext, useState } from "react";
|
||||
import { StyledActionButton, Input, Button, ButtonSubtext } from "..";
|
||||
import { IdeMessengerContext } from "../../context/IdeMessenger";
|
||||
import { QuickstartSubmitButtonProps } from "../OnboardingCard/components/QuickStartSubmitButton";
|
||||
|
||||
function JetBrainsFetchGitHubTokenDialog({
|
||||
onComplete,
|
||||
}: QuickstartSubmitButtonProps) {
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
const [jbGhAuthToken, setJbGhAuthToken] = useState("");
|
||||
const [hasClickedGitHubButton, setHasClickedGitHubButton] = useState(false);
|
||||
|
||||
const submitJetBrainsToken = async () => {
|
||||
await ideMessenger.request("setGitHubAuthToken", { token: jbGhAuthToken });
|
||||
onComplete(jbGhAuthToken);
|
||||
};
|
||||
|
||||
const openGitHubTokenPage = () => {
|
||||
ideMessenger.post(
|
||||
"openUrl",
|
||||
"https://github.com/settings/tokens/new?scopes=user:email&description=Continue%20Free%20Trial%20Token%20",
|
||||
);
|
||||
setHasClickedGitHubButton(true);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="p-8 flex flex-col gap-3">
|
||||
<div className="text-center">
|
||||
<h1 className="my-0">Sign in with GitHub</h1>
|
||||
<p>
|
||||
Continue will request read access to your GitHub email so that we can
|
||||
prevent abuse of the free trial. If you prefer not to sign in, you can
|
||||
use Continue with your own API keys or local model.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col gap-3">
|
||||
{hasClickedGitHubButton ? (
|
||||
<div className="flex flex-col items-start">
|
||||
<label className="text-sm">Token</label>
|
||||
<Input
|
||||
className="flex-1"
|
||||
placeholder="Enter your GitHub token"
|
||||
value={jbGhAuthToken}
|
||||
onChange={(e) => setJbGhAuthToken(e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
<StyledActionButton onClick={openGitHubTokenPage}>
|
||||
<p className="text-sm">Get GitHub token</p>
|
||||
<ArrowTopRightOnSquareIcon width={24} height={24} />
|
||||
</StyledActionButton>
|
||||
)}
|
||||
|
||||
<div>
|
||||
<Button
|
||||
onClick={submitJetBrainsToken}
|
||||
disabled={!jbGhAuthToken}
|
||||
className="grid grid-flow-col items-center gap-2 w-full mt-2"
|
||||
>
|
||||
Get started using our API keys
|
||||
</Button>
|
||||
<ButtonSubtext>
|
||||
Try 50 chat and 2k autocomplete requests
|
||||
</ButtonSubtext>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default JetBrainsFetchGitHubTokenDialog;
|
||||
|
|
@ -2,6 +2,7 @@ import React, { isValidElement, useEffect } from "react";
|
|||
import ReactMarkdown from "react-markdown";
|
||||
import styled from "styled-components";
|
||||
import {
|
||||
CloseButton,
|
||||
VSC_BACKGROUND_VAR,
|
||||
defaultBorderRadius,
|
||||
lightGray,
|
||||
|
|
@ -9,6 +10,16 @@ import {
|
|||
vscBackground,
|
||||
vscForeground,
|
||||
} from "..";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { setShowDialog } from "../../redux/slices/uiStateSlice";
|
||||
import { XMarkIcon } from "@heroicons/react/24/outline";
|
||||
|
||||
interface TextDialogProps {
|
||||
showDialog: boolean;
|
||||
onEnter: () => void;
|
||||
onClose: () => void;
|
||||
message?: string | JSX.Element;
|
||||
}
|
||||
|
||||
const ScreenCover = styled.div`
|
||||
position: fixed;
|
||||
|
|
@ -38,12 +49,9 @@ const Dialog = styled.div`
|
|||
// overflow: hidden;
|
||||
`;
|
||||
|
||||
const TextDialog = (props: {
|
||||
showDialog: boolean;
|
||||
onEnter: () => void;
|
||||
onClose: () => void;
|
||||
message?: string | JSX.Element;
|
||||
}) => {
|
||||
const TextDialog = (props: TextDialogProps) => {
|
||||
const dispatch = useDispatch();
|
||||
|
||||
useEffect(() => {
|
||||
const handleKeyDown = (event: KeyboardEvent) => {
|
||||
if (event.key === "Escape") {
|
||||
|
|
@ -62,18 +70,16 @@ const TextDialog = (props: {
|
|||
}
|
||||
|
||||
return (
|
||||
<ScreenCover
|
||||
onClick={() => {
|
||||
props.onClose();
|
||||
}}
|
||||
hidden={!props.showDialog}
|
||||
>
|
||||
<ScreenCover onClick={props.onClose} hidden={!props.showDialog}>
|
||||
<DialogContainer
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
}}
|
||||
>
|
||||
<Dialog>
|
||||
<CloseButton onClick={props.onClose}>
|
||||
<XMarkIcon className="h-5 w-5" />
|
||||
</CloseButton>
|
||||
{typeof props.message === "string" ? (
|
||||
<ReactMarkdown>{props.message || ""}</ReactMarkdown>
|
||||
) : !React.isValidElement(props.message) ? null : (
|
||||
|
|
|
|||
|
|
@ -41,7 +41,10 @@ function Alert({ children, type = "info" }: AlertProps) {
|
|||
return (
|
||||
<div className="p-4 rounded-lg shadow-none border-l-4 bg-[color:var(--vscode-editor-foreground)] opacity-70">
|
||||
<div className="flex items-start">
|
||||
<Icon className="w-6 h-6" style={{ color: vscBackground }} />
|
||||
<Icon
|
||||
className="w-6 min-w-5 h-6 min-h-5"
|
||||
style={{ color: vscBackground }}
|
||||
/>
|
||||
|
||||
<div className="ml-3" style={{ color: vscBackground }}>
|
||||
{children}
|
||||
|
|
|
|||
|
|
@ -163,13 +163,15 @@ export const SecondaryButton = styled.button`
|
|||
}
|
||||
`;
|
||||
|
||||
export const InputSubtext = styled.p`
|
||||
export const InputSubtext = styled.span`
|
||||
font-size: 0.75rem;
|
||||
line-height: 1rem;
|
||||
color: ${lightGray};
|
||||
margin-top: 0.25rem;
|
||||
`;
|
||||
|
||||
export const ButtonSubtext = styled.p`
|
||||
export const ButtonSubtext = styled.span`
|
||||
display: block;
|
||||
margin-top: 0;
|
||||
text-align: center;
|
||||
color: ${lightGray};
|
||||
|
|
@ -399,7 +401,7 @@ export const Divider = styled.div`
|
|||
background-color: ${lightGray};
|
||||
`;
|
||||
|
||||
export const StyledLinkButton = styled.div`
|
||||
export const StyledActionButton = styled.div`
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
|
@ -410,3 +412,17 @@ export const StyledLinkButton = styled.div`
|
|||
background-color: ${lightGray}33;
|
||||
background-opacity: 0.1;
|
||||
`;
|
||||
|
||||
export const CloseButton = styled.button`
|
||||
border: none;
|
||||
background-color: inherit;
|
||||
color: ${lightGray};
|
||||
position: absolute;
|
||||
top: 0.6rem;
|
||||
right: 1rem;
|
||||
padding: 0.25rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
`;
|
||||
|
|
|
|||
|
|
@ -351,7 +351,7 @@ function ModelSelect() {
|
|||
onClick={onClickAddModel}
|
||||
value={"addModel" as any}
|
||||
>
|
||||
<div className="flex items-center py-2">
|
||||
<div className="flex items-center py-0.5">
|
||||
<PlusIcon className="w-4 h-4 mr-2" />
|
||||
Add Chat model
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { useContext, useEffect, useState } from "react";
|
||||
import { FormProvider, useForm } from "react-hook-form";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { Input, Button, InputSubtext, StyledLinkButton } from "../components";
|
||||
import { Input, Button, InputSubtext, StyledActionButton } from "../components";
|
||||
import ModelSelectionListbox from "../components/modelSelection/ModelSelectionListbox";
|
||||
import { IdeMessengerContext } from "../context/IdeMessenger";
|
||||
import {
|
||||
|
|
@ -139,12 +139,12 @@ function AddModelForm({
|
|||
Install provider
|
||||
</label>
|
||||
|
||||
<StyledLinkButton onClick={onClickDownloadProvider}>
|
||||
<StyledActionButton onClick={onClickDownloadProvider}>
|
||||
<p className="underline text-sm">
|
||||
{selectedProvider.downloadUrl}
|
||||
</p>
|
||||
<ArrowTopRightOnSquareIcon width={24} height={24} />
|
||||
</StyledLinkButton>
|
||||
</StyledActionButton>
|
||||
</div>
|
||||
)}
|
||||
|
||||
|
|
|
|||
32
gui/src/hooks/useTutorialCard.ts
Normal file
32
gui/src/hooks/useTutorialCard.ts
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import { useState } from "react";
|
||||
import { getLocalStorage, setLocalStorage } from "../util/localStorage";
|
||||
import { usePostHog } from "posthog-js/react";
|
||||
|
||||
export type UseTutorialCard = {
|
||||
showTutorialCard: boolean;
|
||||
closeTutorialCard: () => void;
|
||||
openTutorialCard: () => void;
|
||||
};
|
||||
|
||||
export function useTutorialCard(): UseTutorialCard {
|
||||
const posthog = usePostHog();
|
||||
|
||||
const [showTutorialCard, setShowTutorialCard] = useState<boolean>(
|
||||
getLocalStorage("showTutorialCard"),
|
||||
);
|
||||
|
||||
function closeTutorialCard() {
|
||||
posthog.capture("closedTutorialCard");
|
||||
setLocalStorage("showTutorialCard", false);
|
||||
setShowTutorialCard(false);
|
||||
}
|
||||
|
||||
function openTutorialCard() {
|
||||
setLocalStorage("showTutorialCard", true);
|
||||
setShowTutorialCard(true);
|
||||
}
|
||||
|
||||
return { showTutorialCard, closeTutorialCard, openTutorialCard };
|
||||
}
|
||||
|
||||
export default UseTutorialCard;
|
||||
|
|
@ -60,6 +60,7 @@ import { getLocalStorage, setLocalStorage } from "../util/localStorage";
|
|||
import OnboardingCard from "../components/OnboardingCard";
|
||||
import { useOnboardingCard } from "../components/OnboardingCard/utils";
|
||||
import { FREE_TRIAL_LIMIT_REQUESTS } from "../util/freeTrial";
|
||||
import { useTutorialCard } from "../hooks/useTutorialCard";
|
||||
|
||||
const TopGuiDiv = styled.div<{
|
||||
showScrollbar?: boolean;
|
||||
|
|
@ -147,6 +148,7 @@ function GUI() {
|
|||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
|
||||
const onboardingCard = useOnboardingCard();
|
||||
const { showTutorialCard, closeTutorialCard } = useTutorialCard();
|
||||
|
||||
const sessionState = useSelector((state: RootState) => state.state);
|
||||
|
||||
|
|
@ -164,16 +166,6 @@ function GUI() {
|
|||
|
||||
const state = useSelector((state: RootState) => state.state);
|
||||
|
||||
const [showTutorialCard, setShowTutorialCard] = useState<boolean>(
|
||||
getLocalStorage("showTutorialCard"),
|
||||
);
|
||||
|
||||
const onCloseTutorialCard = () => {
|
||||
posthog.capture("closedTutorialCard");
|
||||
setLocalStorage("showTutorialCard", false);
|
||||
setShowTutorialCard(false);
|
||||
};
|
||||
|
||||
const handleScroll = () => {
|
||||
// Temporary fix to account for additional height when code blocks are added
|
||||
const OFFSET_HERUISTIC = 300;
|
||||
|
|
@ -506,7 +498,7 @@ function GUI() {
|
|||
|
||||
{!!showTutorialCard && (
|
||||
<div className="flex justify-center w-full">
|
||||
<TutorialCard onClose={onCloseTutorialCard} />
|
||||
<TutorialCard onClose={closeTutorialCard} />
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
|
|
|
|||
|
|
@ -8,9 +8,51 @@ import IndexingProgressBar from "../components/loaders/IndexingProgressBar";
|
|||
import { IdeMessengerContext } from "../context/IdeMessenger";
|
||||
import { useNavigationListener } from "../hooks/useNavigationListener";
|
||||
import { useWebviewListener } from "../hooks/useWebviewListener";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { setOnboardingCard } from "../redux/slices/uiStateSlice";
|
||||
|
||||
interface MoreActionRowProps {
|
||||
title: string;
|
||||
description: string;
|
||||
buttonText: string;
|
||||
onClick?: () => void;
|
||||
href?: string;
|
||||
}
|
||||
|
||||
function MoreActionRow({
|
||||
title,
|
||||
description,
|
||||
buttonText,
|
||||
onClick,
|
||||
href,
|
||||
}: MoreActionRowProps) {
|
||||
const ButtonOrLink = href ? "a" : "div";
|
||||
const buttonProps = href
|
||||
? { href, target: "_blank", className: "no-underline w-1/2" }
|
||||
: { className: "w-1/2" };
|
||||
|
||||
return (
|
||||
<div className="flex items-center gap-2 w-full">
|
||||
<div className="w-1/2 pr-4">
|
||||
<h3 className="my-0">{title}</h3>
|
||||
<p>{description}</p>
|
||||
</div>
|
||||
<ButtonOrLink {...buttonProps}>
|
||||
<SecondaryButton
|
||||
className="grid grid-flow-col items-center gap-2 w-full"
|
||||
onClick={onClick}
|
||||
>
|
||||
{buttonText}
|
||||
</SecondaryButton>
|
||||
</ButtonOrLink>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function MorePage() {
|
||||
useNavigationListener();
|
||||
|
||||
const dispatch = useDispatch();
|
||||
const navigate = useNavigate();
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
|
||||
|
|
@ -62,92 +104,44 @@ function MorePage() {
|
|||
Help Center
|
||||
</h3>
|
||||
<div className="p-6 flex flex-col gap-6">
|
||||
<div className="grid grid-cols-3 gap-4 items-center">
|
||||
<div className="col-span-2">
|
||||
<h3 className="my-0">Documentation</h3>
|
||||
<p>
|
||||
Visit the documentation site to learn how to configure and use
|
||||
Continue.
|
||||
</p>
|
||||
</div>
|
||||
<a
|
||||
className="col-span-1 "
|
||||
href="https://docs.continue.dev/"
|
||||
target="_blank"
|
||||
>
|
||||
<SecondaryButton className="w-full">View docs</SecondaryButton>
|
||||
</a>
|
||||
</div>
|
||||
<MoreActionRow
|
||||
title="Documentation"
|
||||
description="Visit the documentation site to learn how to configure and use Continue"
|
||||
buttonText="View docs"
|
||||
href="https://docs.continue.dev/"
|
||||
/>
|
||||
|
||||
<div className="grid grid-cols-3 gap-4 items-center">
|
||||
<div className="col-span-2">
|
||||
<h3 className="my-0">Tutorial</h3>
|
||||
<p>
|
||||
Open the tutorial to get a quick walkthrough of the most commonly
|
||||
used features in Continue.
|
||||
</p>
|
||||
</div>
|
||||
<SecondaryButton
|
||||
className="col-span-1 w-full"
|
||||
onClick={() => {
|
||||
ideMessenger.post("showTutorial", undefined);
|
||||
}}
|
||||
>
|
||||
Open tutorial
|
||||
</SecondaryButton>
|
||||
</div>
|
||||
<MoreActionRow
|
||||
title="Tutorial"
|
||||
description="Reopen the tutorial and onboarding card"
|
||||
buttonText="Open tutorial"
|
||||
onClick={() => {
|
||||
navigate("/");
|
||||
dispatch(setOnboardingCard({ show: true, activeTab: "Best" }));
|
||||
ideMessenger.post("showTutorial", undefined);
|
||||
}}
|
||||
/>
|
||||
|
||||
<div className="grid grid-cols-3 gap-4 items-center">
|
||||
<div className="col-span-2">
|
||||
<h3 className="my-0">Token usage stats</h3>
|
||||
<p>
|
||||
See how many tokens you're using each day and how they're
|
||||
distributed across your models.
|
||||
</p>
|
||||
</div>
|
||||
<SecondaryButton
|
||||
className="col-span-1"
|
||||
onClick={() => {
|
||||
navigate("/stats");
|
||||
}}
|
||||
>
|
||||
View token usage
|
||||
</SecondaryButton>
|
||||
</div>
|
||||
<MoreActionRow
|
||||
title="Token usage stats"
|
||||
description="See how many tokens you're using each day and how they're distributed across your models"
|
||||
buttonText="View token usage"
|
||||
onClick={() => navigate("/stats")}
|
||||
/>
|
||||
|
||||
<div className="grid grid-cols-3 gap-4 items-center w-full">
|
||||
<div className="col-span-2">
|
||||
<h3 className="my-0">Have an issue?</h3>
|
||||
<p>Let us know on GitHub and we'll do our best to resolve it.</p>
|
||||
</div>
|
||||
<a
|
||||
href="https://github.com/continuedev/continue/issues/new/choose"
|
||||
target="_blank"
|
||||
className="no-underline"
|
||||
>
|
||||
<SecondaryButton className="grid grid-flow-col items-center gap-2 w-full">
|
||||
Create a GitHub issue
|
||||
</SecondaryButton>
|
||||
</a>
|
||||
</div>
|
||||
<MoreActionRow
|
||||
title="Have an issue?"
|
||||
description="Let us know on GitHub and we'll do our best to resolve it"
|
||||
buttonText="Create a GitHub issue"
|
||||
href="https://github.com/continuedev/continue/issues/new/choose"
|
||||
/>
|
||||
|
||||
<div className="grid grid-cols-3 gap-4 items-center w-full">
|
||||
<div className="col-span-2">
|
||||
<h3 className="my-0">Join the community!</h3>
|
||||
<p>
|
||||
Join us on Discord to stay up-to-date on the latest developments
|
||||
</p>
|
||||
</div>
|
||||
<a
|
||||
href="https://discord.gg/vapESyrFmJ"
|
||||
target="_blank"
|
||||
className="no-underline"
|
||||
>
|
||||
<SecondaryButton className="grid grid-flow-col items-center gap-2 w-full">
|
||||
Continue Discord
|
||||
</SecondaryButton>
|
||||
</a>
|
||||
</div>
|
||||
<MoreActionRow
|
||||
title="Join the community!"
|
||||
description="Join us on Discord to stay up-to-date on the latest developments"
|
||||
buttonText="Continue Discord"
|
||||
href="https://discord.gg/vapESyrFmJ"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<h3
|
||||
|
|
|
|||
|
|
@ -8,18 +8,18 @@ module.exports = {
|
|||
"./src/*.{js,ts,jsx,tsx}",
|
||||
],
|
||||
theme: {
|
||||
screens: {
|
||||
xs: "425px",
|
||||
...defaultTheme.screens,
|
||||
},
|
||||
extend: {
|
||||
animation: {
|
||||
"spin-slow": "spin 3s linear infinite",
|
||||
"spin-slow": "spin 30s linear infinite",
|
||||
},
|
||||
colors: {
|
||||
"vsc-background": "rgb(var(--vsc-background) / <alpha-value>)",
|
||||
"secondary-dark": "rgb(var(--secondary-dark) / <alpha-value>)",
|
||||
},
|
||||
screens: {
|
||||
xs: "425px",
|
||||
...defaultTheme.screens,
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [],
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue