diff --git a/core/control-plane/env.ts b/core/control-plane/env.ts index 3c3697ee5..4556ce90f 100644 --- a/core/control-plane/env.ts +++ b/core/control-plane/env.ts @@ -48,6 +48,3 @@ export const controlPlaneEnv = : process.env.CONTROL_PLANE_ENV === "staging" ? STAGING_ENV : PRODUCTION_ENV; - -export const USE_PLATFORM = - process.env.CONTROL_PLANE_ENV === "local" ? true : false; diff --git a/core/control-plane/flags.ts b/core/control-plane/flags.ts new file mode 100644 index 000000000..3ea598e3b --- /dev/null +++ b/core/control-plane/flags.ts @@ -0,0 +1 @@ +export const USE_PLATFORM = true; diff --git a/core/core.ts b/core/core.ts index b7da406ae..c7bdcf02a 100644 --- a/core/core.ts +++ b/core/core.ts @@ -42,7 +42,7 @@ import { TTS } from "./util/tts"; import { type ContextItemId, type IDE, type IndexingProgressUpdate } from "."; import { SYSTEM_PROMPT_DOT_FILE } from "./config/getSystemPromptDotFile"; -import { USE_PLATFORM } from "./control-plane/env"; +import { USE_PLATFORM } from "./control-plane/flags"; import type { FromCoreProtocol, ToCoreProtocol } from "./protocol"; import type { IMessenger, Message } from "./protocol/messenger"; import { localPathToUri } from "./util/pathToUri"; diff --git a/gui/src/components/OnboardingCard/platform/PlatformOnboardingCard.tsx b/gui/src/components/OnboardingCard/platform/PlatformOnboardingCard.tsx new file mode 100644 index 000000000..360282e4a --- /dev/null +++ b/gui/src/components/OnboardingCard/platform/PlatformOnboardingCard.tsx @@ -0,0 +1,63 @@ +import { XMarkIcon } from "@heroicons/react/24/outline"; +import { useState } from "react"; +import styled from "styled-components"; +import { CloseButton, defaultBorderRadius, vscInputBackground } from "../.."; +import { getLocalStorage, setLocalStorage } from "../../../util/localStorage"; +import Alert from "../../gui/Alert"; +import { TabTitle } from "../components/OnboardingCardTabs"; +import { useOnboardingCard } from "../hooks"; +import OnboardingLocalTab from "../tabs/OnboardingLocalTab"; +import MainTab from "./tabs/main"; + +const StyledCard = styled.div` + margin: auto; + border-radius: ${defaultBorderRadius}; + background-color: ${vscInputBackground}; + box-shadow: + 0 20px 25px -5px rgb(0 0 0 / 0.1), + 0 8px 10px -6px rgb(0 0 0 / 0.1); +`; + +export interface OnboardingCardState { + show?: boolean; + activeTab?: TabTitle; +} + +export function PlatformOnboardingCard() { + const onboardingCard = useOnboardingCard(); + + if (getLocalStorage("onboardingStatus") === undefined) { + setLocalStorage("onboardingStatus", "Started"); + } + + const [currentTab, setCurrentTab] = useState<"main" | "local">("main"); + + return ( + + + + +
+
+ {currentTab === "main" ? ( + setCurrentTab("local")} /> + ) : ( +
+ + By choosing this option, Continue will be configured by a local{" "} + config.yaml file. If you're just looking to use + Ollama and still want to manage your configuration through + Continue, click{" "} + setCurrentTab("main")}> + here + + + + +
+ )} +
+
+
+ ); +} diff --git a/gui/src/components/OnboardingCard/platform/tabs/local.tsx b/gui/src/components/OnboardingCard/platform/tabs/local.tsx new file mode 100644 index 000000000..ae30085ec --- /dev/null +++ b/gui/src/components/OnboardingCard/platform/tabs/local.tsx @@ -0,0 +1,26 @@ +import { useAuth } from "../../../../context/Auth"; +import ContinueLogo from "../../../gui/ContinueLogo"; +import { useOnboardingCard } from "../../hooks"; + +export default function LocalTab() { + const onboardingCard = useOnboardingCard(); + const auth = useAuth(); + + return ( +
+
+ +
+ +

+ Log in to quickly build your first custom AI code assistant +

+ + {/*

+ To prevent abuse, we'll ask you to sign in to GitHub. +

*/} + +
+
+ ); +} diff --git a/gui/src/components/OnboardingCard/platform/tabs/main.tsx b/gui/src/components/OnboardingCard/platform/tabs/main.tsx new file mode 100644 index 000000000..4295dd18d --- /dev/null +++ b/gui/src/components/OnboardingCard/platform/tabs/main.tsx @@ -0,0 +1,46 @@ +import { ChevronRightIcon } from "@heroicons/react/24/outline"; +import { Button, ButtonSubtext } from "../../.."; +import { useAuth } from "../../../../context/Auth"; +import ContinueLogo from "../../../gui/ContinueLogo"; +import { useOnboardingCard } from "../../hooks"; + +export default function MainTab({ + onRemainLocal, +}: { + onRemainLocal: () => void; +}) { + const onboardingCard = useOnboardingCard(); + const auth = useAuth(); + + function onGetStarted() { + auth.login(true); + onboardingCard.close(); + } + + return ( +
+
+ +
+ +

+ Log in to quickly build your first custom AI code assistant +

+ +
+ + +
+ Or, remain local + +
+
+
+
+ ); +} diff --git a/gui/src/pages/gui/Chat.tsx b/gui/src/pages/gui/Chat.tsx index de8453445..4ab0d7997 100644 --- a/gui/src/pages/gui/Chat.tsx +++ b/gui/src/pages/gui/Chat.tsx @@ -6,6 +6,7 @@ import { } from "@heroicons/react/24/outline"; import { Editor, JSONContent } from "@tiptap/react"; import { InputModifiers, RangeInFileWithContents, ToolCallState } from "core"; +import { USE_PLATFORM } from "core/control-plane/flags"; import { streamResponse } from "core/llm/stream"; import { stripImages } from "core/util/messageContent"; import { usePostHog } from "posthog-js/react"; @@ -32,6 +33,7 @@ import { OnboardingCard, useOnboardingCard, } from "../../components/OnboardingCard"; +import { PlatformOnboardingCard } from "../../components/OnboardingCard/platform/PlatformOnboardingCard"; import PageHeader from "../../components/PageHeader"; import StepContainer from "../../components/StepContainer"; import AcceptRejectAllButtons from "../../components/StepContainer/AcceptRejectAllButtons"; @@ -57,6 +59,7 @@ import { import { RootState } from "../../redux/store"; import { cancelStream } from "../../redux/thunks/cancelStream"; import { exitEditMode } from "../../redux/thunks/exitEditMode"; +import { loadLastSession } from "../../redux/thunks/session"; import { streamResponseThunk } from "../../redux/thunks/streamResponse"; import { getFontSize, @@ -70,7 +73,6 @@ import ConfigErrorIndicator from "./ConfigError"; import { ToolCallDiv } from "./ToolCallDiv"; import { ToolCallButtons } from "./ToolCallDiv/ToolCallButtonsDiv"; import ToolOutput from "./ToolCallDiv/ToolOutput"; -import { loadLastSession } from "../../redux/thunks/session"; const StopButton = styled.div` background-color: ${vscBackground}; @@ -540,7 +542,11 @@ export function Chat() { <> {onboardingCard.show && (
- + {USE_PLATFORM ? ( + + ) : ( + + )}
)}