- {options.map((option, idx) => (
+
+ {sortedOptions.map((option, idx) => (
1}
+ showMissingApiKeyMsg={option.apiKey === ""}
/>
))}
@@ -268,37 +344,26 @@ function ModelSelect() {
{selectedProfileId === "local" && (
<>
- {options.length > 0 &&
}
+ {options.length > 0 &&
}
{
- e.stopPropagation();
- e.preventDefault();
- navigate("/addModel");
- }}
+ onClick={onClickAddModel}
value={"addModel" as any}
>
-
+
- Add Model
+ Add Chat model
>
)}
-
+
-
- {getMetaKeyLabel()}' to toggle
-
+
+ {getMetaKeyLabel()} + ' to toggle
+
diff --git a/gui/src/components/modelSelection/quickSetup/StyledListbox.tsx b/gui/src/components/modelSelection/quickSetup/StyledListbox.tsx
index ee40afa31..48878dd6c 100644
--- a/gui/src/components/modelSelection/quickSetup/StyledListbox.tsx
+++ b/gui/src/components/modelSelection/quickSetup/StyledListbox.tsx
@@ -2,6 +2,7 @@ import { Listbox } from "@headlessui/react";
import styled from "styled-components";
import {
defaultBorderRadius,
+ lightGray,
vscBackground,
vscButtonBackground,
vscForeground,
@@ -25,7 +26,7 @@ export const StyledListboxButton = styled(Listbox.Button)`
padding-bottom: 0.5rem;
border-radius: 0.5em;
- border: 1px solid ${vscButtonBackground};
+ border: 1px solid ${lightGray};
margin: 0;
height: 100%;
diff --git a/gui/src/forms/AddModelForm.tsx b/gui/src/forms/AddModelForm.tsx
new file mode 100644
index 000000000..5757dc59d
--- /dev/null
+++ b/gui/src/forms/AddModelForm.tsx
@@ -0,0 +1,211 @@
+import { useContext, useEffect, useState } from "react";
+import { FormProvider, useForm } from "react-hook-form";
+import { useDispatch } from "react-redux";
+import { Input, Button, InputSubtext } from "../components";
+import QuickSetupListBox from "../components/modelSelection/quickSetup/QuickSetupListBox";
+import { IdeMessengerContext } from "../context/IdeMessenger";
+import {
+ ProviderInfo,
+ providers,
+} from "../pages/AddNewModel/configs/providers";
+import { setDefaultModel } from "../redux/slices/stateSlice";
+import { hasPassedFTL, FREE_TRIAL_LIMIT_REQUESTS } from "../util/freeTrial";
+import SubmitButtonSubtext from "../components/OnboardingCard/components/SubmitButtonSubtext";
+import Alert from "../components/gui/Alert";
+import LinkButton from "../components/LinkButton";
+
+interface QuickModelSetupProps {
+ onDone: () => void;
+ hideFreeTrialLimitMessage?: boolean;
+}
+
+function AddModelForm({
+ onDone,
+ hideFreeTrialLimitMessage,
+}: QuickModelSetupProps) {
+ const [selectedProvider, setSelectedProvider] = useState
(
+ providers["openai"]!,
+ );
+
+ const [selectedModel, setSelectedModel] = useState(
+ selectedProvider.packages[0],
+ );
+
+ const formMethods = useForm();
+ const dispatch = useDispatch();
+ const ideMessenger = useContext(IdeMessengerContext);
+
+ const selectedProviderApiKeyUrl = selectedModel.params.model.startsWith(
+ "codestral",
+ )
+ ? "https://console.mistral.ai/codestral"
+ : selectedProvider.apiKeyUrl;
+
+ function isDisabled() {
+ if (selectedProvider.downloadUrl) {
+ return false;
+ }
+
+ const apiKey = formMethods.watch("apiKey");
+ return typeof apiKey === "undefined" || apiKey.length === 0;
+ }
+
+ useEffect(() => {
+ setSelectedModel(selectedProvider.packages[0]);
+ }, [selectedProvider]);
+
+ function onSubmit() {
+ const apiKey = formMethods.watch("apiKey");
+ const hasValidApiKey = apiKey !== undefined && apiKey !== "";
+
+ const model = {
+ ...selectedProvider.params,
+ ...selectedModel.params,
+ provider: selectedProvider.provider,
+ title: selectedModel.title,
+ ...(hasValidApiKey ? { apiKey } : {}),
+ };
+
+ debugger;
+
+ ideMessenger.post("config/addModel", { model });
+ ideMessenger.post("openConfigJson", undefined);
+
+ dispatch(setDefaultModel({ title: model.title, force: true }));
+
+ onDone();
+ }
+
+ function onClickDownloadProvider() {
+ selectedProvider.downloadUrl &&
+ ideMessenger.post("openUrl", selectedProvider.downloadUrl);
+ }
+
+ return (
+
+
+
+ );
+}
+
+export default AddModelForm;
diff --git a/gui/src/hooks/useVscTheme.ts b/gui/src/hooks/useVscTheme.ts
index 4a28f945c..959142ba6 100644
--- a/gui/src/hooks/useVscTheme.ts
+++ b/gui/src/hooks/useVscTheme.ts
@@ -54,7 +54,7 @@ const hljsToTextMate: Record = {
};
function constructTheme(
- tmTheme: typeof window.fullColorTheme
+ tmTheme: typeof window.fullColorTheme,
): Record {
const rules = tmTheme["rules"] || [];
@@ -151,7 +151,7 @@ function fallbackTheme() {
export function useVscTheme() {
const [theme, setTheme] = useState(
- constructTheme(window.fullColorTheme || {})
+ constructTheme(window.fullColorTheme || {}),
);
useWebviewListener("setTheme", async (data) => {
diff --git a/gui/src/pages/AddNewModel/configs/providers.ts b/gui/src/pages/AddNewModel/configs/providers.ts
index e36bd35b4..5d911cb29 100644
--- a/gui/src/pages/AddNewModel/configs/providers.ts
+++ b/gui/src/pages/AddNewModel/configs/providers.ts
@@ -165,7 +165,7 @@ Select the \`GPT-4o\` model below to complete your provider configuration, but n
],
},
mistral: {
- title: "Mistral API",
+ title: "Mistral",
provider: "mistral",
description:
"The Mistral API provides seamless access to their models, including Codestral, Mistral 8x22B, Mistral Large, and more.",
@@ -202,7 +202,7 @@ Select the \`GPT-4o\` model below to complete your provider configuration, but n
description:
"One of the fastest ways to get started with local models on Mac, Linux, or Windows",
longDescription:
- 'To get started with Ollama, follow these steps:\n1. Download from [ollama.ai](https://ollama.ai/) and open the application\n2. Open a terminal and run `ollama run `. Example model names are `codellama:7b-instruct` or `llama2:7b-text`. You can find the full list [here](https://ollama.ai/library).\n3. Make sure that the model name used in step 2 is the same as the one in config.json (e.g. `model="codellama:7b-instruct"`)\n4. Once the model has finished downloading, you can start asking questions through Continue.',
+ 'To get started with Ollama, follow these steps:\n1. Download from [ollama.ai](https://ollama.ai/download) and open the application\n2. Open a terminal and run `ollama run `. Example model names are `codellama:7b-instruct` or `llama2:7b-text`. You can find the full list [here](https://ollama.ai/library).\n3. Make sure that the model name used in step 2 is the same as the one in config.json (e.g. `model="codellama:7b-instruct"`)\n4. Once the model has finished downloading, you can start asking questions through Continue.',
icon: "ollama.png",
tags: [ModelProviderTags.Local, ModelProviderTags.OpenSource],
packages: [
@@ -219,7 +219,7 @@ Select the \`GPT-4o\` model below to complete your provider configuration, but n
...completionParamsInputsConfigs,
{ ...apiBaseInput, defaultValue: "http://localhost:11434" },
],
- downloadUrl: "https://ollama.ai/",
+ downloadUrl: "https://ollama.ai/download",
},
cohere: {
title: "Cohere",
@@ -490,28 +490,28 @@ To get started, [register](https://dataplatform.cloud.ibm.com/registration/stepo
key: "watsonxUrl",
label: "watsonx URL",
placeholder: "e.g. http://us-south.dataplatform.cloud.ibm.com",
- required: true
+ required: true,
},
{
inputType: "text",
key: "watsonxProjectId",
label: "watsonx Project ID",
placeholder: "Enter your project ID",
- required: true
+ required: true,
},
{
inputType: "text",
key: "watsonxCreds",
label: "watsonx API key",
placeholder: "Enter your API key (SaaS) or ZenApiKey (Software)",
- required: true
+ required: true,
},
{
inputType: "text",
key: "watsonxApiVersion",
label: "watsonx API version",
placeholder: "Enter the API Version",
- defaultValue: "2023-05-29"
+ defaultValue: "2023-05-29",
},
// {
// inputType: "text",
diff --git a/gui/src/pages/gui.tsx b/gui/src/pages/gui.tsx
index 0e5c103c8..b4720f28c 100644
--- a/gui/src/pages/gui.tsx
+++ b/gui/src/pages/gui.tsx
@@ -223,11 +223,11 @@ function GUI() {
if (u) {
setLocalStorage("ftc", u + 1);
- if (u >= FREE_TRIAL_LIMIT_REQUESTS) {
- navigate("/onboarding");
- posthog?.capture("ftc_reached");
- return;
- }
+ // if (u >= FREE_TRIAL_LIMIT_REQUESTS) {
+ // navigate("/onboarding");
+ // posthog?.capture("ftc_reached");
+ // return;
+ // }
} else {
setLocalStorage("ftc", 1);
}
diff --git a/gui/src/pages/onboarding/ApiKeysOnboarding.tsx b/gui/src/pages/onboarding/ApiKeysOnboarding.tsx
deleted file mode 100644
index 209db68b8..000000000
--- a/gui/src/pages/onboarding/ApiKeysOnboarding.tsx
+++ /dev/null
@@ -1,66 +0,0 @@
-import { ArrowLeftIcon } from "@heroicons/react/24/outline";
-import { useContext, useState } from "react";
-import { useNavigate } from "react-router-dom";
-import QuickModelSetup from "../../components/modelSelection/quickSetup/QuickModelSetup";
-import Toggle from "../../components/modelSelection/Toggle";
-import { IdeMessengerContext } from "../../context/IdeMessenger";
-import { getLocalStorage } from "../../util/localStorage";
-import { useCompleteOnboarding } from "./utils";
-import DefaultModelConfigForm from "../../components/OnboardingCard/components/DefaultModelConfigForm";
-
-function ApiKeysOnboarding() {
- const ideMessenger = useContext(IdeMessengerContext);
- const navigate = useNavigate();
-
- const [isBestToggle, setIsBestToggle] = useState(true);
-
- const { completeOnboarding } = useCompleteOnboarding();
-
- return (
-
-
-
navigate(-1)}
- className="inline-block cursor-pointer"
- />
-
-
-
-
Model setup
-
- Choose between our default configuration that includes the best models
- available, or configure your own setup.
-
-
-
-
{
- setIsBestToggle((prev) => !prev);
- }}
- />
-
- {isBestToggle && }
-
- {!isBestToggle && (
- {
- ideMessenger.post("showTutorial", undefined);
-
- if (getLocalStorage("signedInToGh")) {
- completeOnboarding();
- } else {
- navigate("/apiKeyAutocompleteOnboarding");
- }
- }}
- >
- )}
-
- );
-}
-
-export default ApiKeysOnboarding;
diff --git a/gui/src/pages/onboarding/CheckMarkHeader.tsx b/gui/src/pages/onboarding/CheckMarkHeader.tsx
deleted file mode 100644
index 6e3b27c57..000000000
--- a/gui/src/pages/onboarding/CheckMarkHeader.tsx
+++ /dev/null
@@ -1,26 +0,0 @@
-import { CheckCircleIcon as CheckCircleIconSolid } from "@heroicons/react/24/solid";
-import { lightGray } from "../../components";
-
-export function CheckMarkHeader(props: {
- children: string;
- isComplete: boolean;
-}) {
- return (
-
- {props.isComplete ? (
-
- ) : (
-
- )}
-
{props.children}
-
- );
-}
diff --git a/gui/src/pages/onboarding/CopyToTerminalButton.tsx b/gui/src/pages/onboarding/CopyToTerminalButton.tsx
deleted file mode 100644
index d2c371169..000000000
--- a/gui/src/pages/onboarding/CopyToTerminalButton.tsx
+++ /dev/null
@@ -1,98 +0,0 @@
-import ReactDOM from "react-dom";
-import { useState, useContext } from "react";
-import { CheckIcon, CommandLineIcon } from "@heroicons/react/24/outline";
-import styled from "styled-components";
-import {
- StyledTooltip,
- defaultBorderRadius,
- lightGray,
- vscForeground,
-} from "../../components";
-import { IdeMessengerContext } from "../../context/IdeMessenger";
-
-export type CopyToTerminalButtonProps = {
- children: string;
-};
-
-const StyledDiv = styled.div<{ clicked: boolean }>`
- padding-left: 8px;
- padding-right: 8px;
- display: flex;
- border-radius: ${defaultBorderRadius};
- width: fit-content;
- gap: 8px;
-
- ${({ clicked }) => clicked && "background-color: #0f02;"}
-
- align-items: center;
-
- border: 1px solid ${lightGray};
-
- cursor: pointer;
- &:hover {
- background-color: ${({ clicked }) => (clicked ? "#0f02" : "#fff1")};
- }
-`;
-
-export function CopyToTerminalButton(props: CopyToTerminalButtonProps) {
- const [clicked, setClicked] = useState(false);
-
- const id = `info-hover-${encodeURIComponent(props.children)}`;
- const tooltipPortalDiv = document.getElementById("tooltip-portal-div");
-
- const ideMessenger = useContext(IdeMessengerContext);
-
- return (
- <>
-
-
{
- ideMessenger.ide.runCommand(props.children);
- setClicked(true);
- setTimeout(() => setClicked(false), 2000);
- ideMessenger.post("copyText", { text: props.children });
- }}
- >
- {clicked ? (
-
- ) : (
-
- )}
-
-
-
- {props.children}
-
-
-
-
- {tooltipPortalDiv &&
- ReactDOM.createPortal(
-
- Copy to terminal
- ,
- tooltipPortalDiv,
- )}
- >
- );
-}
diff --git a/gui/src/pages/onboarding/LocalOnboarding.tsx b/gui/src/pages/onboarding/LocalOnboarding.tsx
deleted file mode 100644
index 04611c553..000000000
--- a/gui/src/pages/onboarding/LocalOnboarding.tsx
+++ /dev/null
@@ -1,229 +0,0 @@
-import { ArrowLeftIcon } from "@heroicons/react/24/outline";
-import { ONBOARDING_LOCAL_MODEL_TITLE } from "core/config/onboarding";
-import { useContext, useEffect, useState } from "react";
-import { useNavigate } from "react-router-dom";
-import { IdeMessengerContext } from "../../context/IdeMessenger";
-import { CheckMarkHeader } from "./CheckMarkHeader";
-import { StyledButton } from "./components";
-import { CopyToTerminalButton } from "./CopyToTerminalButton";
-import { useCompleteOnboarding } from "./utils";
-
-type OllamaConnectionStatuses =
- | "waiting_to_download"
- | "downloading"
- | "verified";
-
-enum DefaultLocalModels {
- Chat = "llama3",
- Autocomplete = "starcoder2:3b",
- Embeddings = "nomic-embed-text",
-}
-
-const OLLAMA_DOWNLOAD_URL = "https://ollama.com/download";
-const REFETCH_MODELS_INTERVAL_MS = 1000;
-
-function LocalOnboarding() {
- const navigate = useNavigate();
- const ideMessenger = useContext(IdeMessengerContext);
-
- const [downloadedOllamaModels, setDownloadedOllamaModels] = useState<
- string[] | undefined
- >(undefined);
-
- const [ollamaConnectionStatus, setOllamaConnectionStatus] =
- useState("waiting_to_download");
-
- const [hasLoadedChatModel, setHasLoadedChatModel] = useState(false);
-
- const { completeOnboarding } = useCompleteOnboarding();
-
- const isOllamaConnected = ollamaConnectionStatus === "verified";
-
- function isModelDownloaded(model: string) {
- if (!downloadedOllamaModels) {
- return false;
- }
-
- return downloadedOllamaModels.some(
- (ollamaModel) => ollamaModel.startsWith(model), // We use `startsWith` to ignore trailing tags like `:latest`
- );
- }
-
- function renderOllamaConnectionStatus(status: OllamaConnectionStatuses) {
- switch (status) {
- case "waiting_to_download":
- return (
-
- );
-
- case "downloading":
- return Checking for connection to Ollama...
;
-
- case "verified":
- return <>>;
-
- default:
- return <>>;
- }
- }
-
- /**
- * The first time we detect that a chat model has been loaded,
- * we send an empty request to load it
- */
- useEffect(() => {
- if (!hasLoadedChatModel && isModelDownloaded(DefaultLocalModels.Chat)) {
- ideMessenger.post("llm/complete", {
- completionOptions: {},
- prompt: "",
- title: ONBOARDING_LOCAL_MODEL_TITLE,
- });
-
- setHasLoadedChatModel(true);
- }
- }, [downloadedOllamaModels]);
-
- /**
- * Sets up an interval that runs every `REFETCH_MODELS_INTERVAL_MS`
- * to fetch the list of downloaded models and update state.
- */
- useEffect(() => {
- const fetchDownloadedModels = async () => {
- const models = await ideMessenger.request("llm/listModels", {
- title: ONBOARDING_LOCAL_MODEL_TITLE,
- });
-
- if (Array.isArray(models)) {
- // If we got a response, the connection has been verified
- if (!isOllamaConnected) {
- setOllamaConnectionStatus("verified");
- }
-
- setDownloadedOllamaModels(models);
- }
- };
-
- // Immediately invoke to try to minimize jank if a user already has
- // the models installed. A better fix would be to not load the onboarding
- // steps until we've first checked if the user already has the models installed.
- fetchDownloadedModels();
-
- const interval = setInterval(
- fetchDownloadedModels,
- REFETCH_MODELS_INTERVAL_MS,
- );
-
- return () => {
- clearInterval(interval);
- };
- }, []);
-
- return (
-
-
-
navigate(-1)}
- className="inline-block cursor-pointer"
- />
-
-
-
Set up your local LLM
-
-
-
- 1. Download and start Ollama
-
-
- {renderOllamaConnectionStatus(ollamaConnectionStatus)}
-
-
-
-
- 2. Download a model for chat
-
- {!isModelDownloaded(DefaultLocalModels.Chat) && (
-
-
- We recommend using {DefaultLocalModels.Chat}, the
- latest open-source model trained by Meta.
-
-
-
- {` ollama run ${DefaultLocalModels.Chat}`}
-
-
- )}
-
-
-
-
- 3. Download a model for tab autocomplete
-
-
- {!isModelDownloaded(DefaultLocalModels.Autocomplete) && (
-
-
- We recommend using {DefaultLocalModels.Autocomplete},
- a state-of-the-art 3B parameter autocomplete model trained by
- Hugging Face.
-
-
-
- {`ollama run ${DefaultLocalModels.Autocomplete}`}
-
-
- )}
-
-
-
-
- 4. Download a model for embeddings
-
-
- {!isModelDownloaded(DefaultLocalModels.Embeddings) && (
-
-
- We recommend using {DefaultLocalModels.Embeddings}, a
- 8192 context-length that outperforms OpenAI ada-002{" "}
- and text-embedding-3-small
- on both short and long context tasks.
-
-
-
- {`ollama pull ${DefaultLocalModels.Embeddings}`}
-
-
- )}
-
-
-
-
- Complete onboarding
-
-
-
- );
-}
-
-export default LocalOnboarding;
diff --git a/gui/src/pages/onboarding/Onboarding.tsx b/gui/src/pages/onboarding/Onboarding.tsx
deleted file mode 100644
index a1de9a528..000000000
--- a/gui/src/pages/onboarding/Onboarding.tsx
+++ /dev/null
@@ -1,223 +0,0 @@
-import {
- CheckBadgeIcon,
- Cog6ToothIcon,
- ComputerDesktopIcon,
- GiftIcon,
-} from "@heroicons/react/24/outline";
-import { ToCoreFromIdeOrWebviewProtocol } from "core/protocol/core";
-import { useContext, useEffect, useState } from "react";
-import { useDispatch } from "react-redux";
-import { useNavigate } from "react-router-dom";
-import { lightGray } from "../../components";
-import ConfirmationDialog from "../../components/dialogs/ConfirmationDialog";
-import GitHubSignInButton from "../../components/modelSelection/quickSetup/GitHubSignInButton";
-import { IdeMessengerContext } from "../../context/IdeMessenger";
-import {
- setDialogMessage,
- setShowDialog,
-} from "../../redux/slices/uiStateSlice";
-import { isJetBrains } from "../../util";
-import { FREE_TRIAL_LIMIT_REQUESTS, hasPassedFTL } from "../../util/freeTrial";
-import { Div, StyledButton } from "./components";
-import { isNewUserOnboarding, useCompleteOnboarding } from "./utils";
-import { setLocalStorage } from "../../util/localStorage";
-import { usePostHog } from "posthog-js/react";
-
-type OnboardingMode =
- ToCoreFromIdeOrWebviewProtocol["completeOnboarding"][0]["mode"];
-
-function Onboarding() {
- const navigate = useNavigate();
- const dispatch = useDispatch();
- const posthog = usePostHog();
- const ideMessenger = useContext(IdeMessengerContext);
-
- const [hasSignedIntoGh, setHasSignedIntoGh] = useState(false);
- const [selectedOnboardingMode, setSlectedOnboardingMode] = useState<
- OnboardingMode | undefined
- >(undefined);
-
- const { completeOnboarding } = useCompleteOnboarding();
-
- function onSubmit() {
- ideMessenger.post("completeOnboarding", {
- mode: selectedOnboardingMode,
- });
-
- /**
- * "completeOnboarding" above will update the config with our
- * new embeddings provider. If it's not the default local provider,
- * we need to re-index the codebase.
- */
- if (selectedOnboardingMode !== "local") {
- ideMessenger.post("index/forceReIndex", undefined);
- }
-
- switch (selectedOnboardingMode) {
- case "local":
- navigate("/localOnboarding");
- break;
-
- case "apiKeys":
- navigate("/apiKeysOnboarding");
- break;
-
- case "freeTrial":
- completeOnboarding();
- break;
-
- default:
- break;
- }
- }
-
- useEffect(() => {
- if (isNewUserOnboarding()) {
- posthog.capture("Onboarding Step", { status: "Started" });
- setLocalStorage("onboardingStatus", "Started");
- }
- }, []);
-
- return (
-
-
-
Welcome to Continue
-
- Let's find the setup that works best for you. You can update your
- configuration after onboarding by clicking the
-
- icon in the bottom-right corner of Continue.
-
-
-
-
- {(!hasPassedFTL() || isJetBrains()) && (
-
setSlectedOnboardingMode("freeTrial")}
- >
-
-
- Free trial
-
-
- Start your free trial of {FREE_TRIAL_LIMIT_REQUESTS} requests by
- signing into GitHub.
-
-
-
-
- Chat: Llama 3 with Ollama, LM Studio, etc.
-
-
- Embeddings: Nomic Embed
-
-
- Autocomplete: Starcoder2 3B
-
-
-
- {!hasSignedIntoGh && (
-
- setHasSignedIntoGh(true)}
- >
-
- )}
-
- )}
-
setSlectedOnboardingMode("local")}
- >
-
-
- Local models
-
-
- No code will leave your computer, but less powerful models are used.
-
-
-
-
- Chat: Llama 3 with Ollama, LM Studio, etc.
-
-
- Embeddings: Nomic Embed
-
-
- Autocomplete: Starcoder2 3B
-
-
-
-
-
setSlectedOnboardingMode("apiKeys")}
- >
-
-
- Best experience
-
-
- Start with the most powerful models available, or customize your own
- configuration.
-
-
-
-
- Chat: Claude 3.5 Sonnet
-
-
- Embeddings: Voyage Code 2
-
-
- Autocomplete: Codestral
-
-
-
-
-
-
-
-
{
- dispatch(setShowDialog(true));
- dispatch(
- setDialogMessage(
- {
- completeOnboarding();
- }}
- />,
- ),
- );
- }}
- >
- Skip
-
-
- Continue
-
-
-
-
- );
-}
-
-export default Onboarding;
diff --git a/gui/src/pages/onboarding/apiKeyAutocompleteOnboarding.tsx b/gui/src/pages/onboarding/apiKeyAutocompleteOnboarding.tsx
deleted file mode 100644
index 45f667182..000000000
--- a/gui/src/pages/onboarding/apiKeyAutocompleteOnboarding.tsx
+++ /dev/null
@@ -1,218 +0,0 @@
-import { Transition } from "@headlessui/react";
-import { CheckIcon, ChevronUpDownIcon } from "@heroicons/react/24/outline";
-import { ModelProvider } from "core";
-import { TRIAL_FIM_MODEL } from "core/config/onboarding";
-import { Fragment, useContext, useState } from "react";
-import { useNavigate } from "react-router-dom";
-import { Button, Input, SecondaryButton } from "../../components";
-import GitHubSignInButton from "../../components/modelSelection/quickSetup/GitHubSignInButton";
-import {
- StyledListbox,
- StyledListboxButton,
- StyledListboxOption,
- StyledListboxOptions,
-} from "../../components/modelSelection/quickSetup/StyledListbox";
-import { IdeMessengerContext } from "../../context/IdeMessenger";
-import { useCompleteOnboarding } from "./utils";
-
-interface AutocompleteOption {
- provider: ModelProvider;
- title: string;
- icon?: string;
-}
-
-const AUTOCOMPLETE_PROVIDER_OPTIONS: AutocompleteOption[] = [
- {
- provider: "free-trial",
- title: "Free Trial (Codestral)",
- // icon: "fireworks.png",
- },
- {
- provider: "fireworks",
- title: "Fireworks AI",
- // icon: "fireworks.png",
- },
- {
- provider: "ollama",
- title: "Ollama",
- icon: "ollama.png",
- },
-];
-
-interface AutocompleteModelDropdownProps {
- selectedProvider: AutocompleteOption;
- setSelectedProvider: any;
-}
-
-function AutocompleteModelDropdown({
- selectedProvider,
- setSelectedProvider,
-}: AutocompleteModelDropdownProps) {
- return (
-
-
-
-
- {window.vscMediaUrl && selectedProvider.icon && (
-
- )}
- {selectedProvider.title}
-
-
-
-
-
-
-
- {AUTOCOMPLETE_PROVIDER_OPTIONS.map((option, index) => (
-
- `relative cursor-default select-none py-2 pl-10 pr-4 ${
- active ? "bg-amber-100 text-amber-900" : "text-gray-900"
- }`
- }
- value={option}
- >
- {({ selected }) => (
- <>
- {window.vscMediaUrl && option.icon && (
-
- )}
- {option.title}
-
- {selected ? (
-
-
-
- ) : null}
- >
- )}
-
- ))}
-
-
-
-
- );
-}
-
-function ApiKeyAutocompleteOnboarding() {
- const ideMessenger = useContext(IdeMessengerContext);
- const navigate = useNavigate();
-
- const [selectedProvider, setSelectedProvider] = useState(
- AUTOCOMPLETE_PROVIDER_OPTIONS[0],
- );
-
- const [apiKeyValue, setApiKeyValue] = useState("");
-
- const { completeOnboarding } = useCompleteOnboarding();
-
- return (
-
-
Autocomplete Model
-
- Tab autocomplete requires a separate model. Currently we are supporting
- free usage by signing in with GitHub. Alternatively, select another
- option from the dropdown.
-
-
-
-
-
-
-
-
- {selectedProvider.provider === "ollama" && (
-
- {
- navigate("/localOnboarding");
- }}
- >
- Set up Ollama
-
-
- )}
- {selectedProvider.provider === "free-trial" && (
-
-
Sign in to GitHub to try autocomplete for free
-
{
- await ideMessenger.request("addAutocompleteModel", {
- model: {
- title: "Autocomplete Trial",
- provider: "free-trial",
- model: TRIAL_FIM_MODEL,
- },
- });
-
- completeOnboarding();
- }}
- >
-
- )}
- {selectedProvider.provider === "fireworks" && (
-
-
Paste your API key
- {
- ideMessenger.post("openUrl", "https://fireworks.ai/api-keys");
- }}
- >
- Get API Key
-
- {
- setApiKeyValue(e.target.value);
- }}
- />
- {
- await ideMessenger.request("addAutocompleteModel", {
- model: {
- title: "Fireworks Autocomplete",
- provider: "fireworks",
- model: "starcoder-7b",
- apiKey: apiKeyValue,
- },
- });
-
- completeOnboarding();
- }}
- >
- Save
-
-
- )}
-
- );
-}
-
-export default ApiKeyAutocompleteOnboarding;
diff --git a/gui/src/pages/onboarding/components.ts b/gui/src/pages/onboarding/components.ts
deleted file mode 100644
index 243606722..000000000
--- a/gui/src/pages/onboarding/components.ts
+++ /dev/null
@@ -1,41 +0,0 @@
-import styled from "styled-components";
-import {
- Button,
- defaultBorderRadius,
- lightGray,
- vscForeground,
-} from "../../components";
-
-export const StyledButton = styled(Button)<{ blurColor?: string }>`
- background-color: transparent;
- color: ${vscForeground};
- border: 1px solid ${lightGray}cc;
-
- &:hover {
- border: 1px solid ${lightGray};
- background-color: ${lightGray}22;
- }
-`;
-
-export const Div = styled.div<{
- selected: boolean;
-}>`
- border: 1px solid ${lightGray};
- border-radius: ${defaultBorderRadius};
- transition: all 0.2s;
- padding-left: 16px;
- padding-right: 16px;
-
- &:hover {
- ${(props) => (props.selected ? "" : `background-color: ${lightGray}22;`)}
- box-shadow: 0 0 4px 0px ${lightGray};
- cursor: pointer;
- }
-
- ${(props) =>
- props.selected &&
- `
- background-color: ${lightGray}44;
- box-shadow: 0 0 4px 0px ${lightGray};
- `}
-`;
diff --git a/gui/tailwind.config.cjs b/gui/tailwind.config.cjs
index b8be7d183..94f73c531 100644
--- a/gui/tailwind.config.cjs
+++ b/gui/tailwind.config.cjs
@@ -9,6 +9,9 @@ module.exports = {
],
theme: {
extend: {
+ animation: {
+ "spin-slow": "spin 3s linear infinite",
+ },
colors: {
"vsc-background": "rgb(var(--vsc-background) / )",
"secondary-dark": "rgb(var(--secondary-dark) / )",