Merge pull request #5088 from NinjaPerson24119/allow-skip-ollama-onboarding
Allow skipping ollama onboarding
This commit is contained in:
commit
906fbd82e0
6 changed files with 67 additions and 34 deletions
|
|
@ -1,9 +1,9 @@
|
|||
import { CommandLineIcon } from "@heroicons/react/24/outline";
|
||||
import { useContext } from "react";
|
||||
import { IdeMessengerContext } from "../../../context/IdeMessenger";
|
||||
import { StyledActionButton } from "../..";
|
||||
import OllamaCompletedStep from "./OllamaCompletedStep";
|
||||
import { IdeMessengerContext } from "../../../context/IdeMessenger";
|
||||
import { ToolTip } from "../../gui/Tooltip";
|
||||
import OllamaCompletedStep from "./OllamaCompletedStep";
|
||||
|
||||
interface OllamaModelDownloadProps {
|
||||
title: string;
|
||||
|
|
@ -27,14 +27,18 @@ function OllamaModelDownload({
|
|||
|
||||
return (
|
||||
<div className="flex flex-col">
|
||||
<p className="mb-1 mt-4 text-base font-semibold sm:text-lg">{title}</p>
|
||||
<p className="mb-1 mt-4 text-base font-semibold">{title}</p>
|
||||
{hasDownloaded ? (
|
||||
<OllamaCompletedStep text={command} />
|
||||
) : (
|
||||
<>
|
||||
<StyledActionButton data-tooltip-id={id} onClick={onClick}>
|
||||
<StyledActionButton
|
||||
data-tooltip-id={id}
|
||||
onClick={onClick}
|
||||
className="gap-2"
|
||||
>
|
||||
<p className="lines m-0 px-0 py-2 font-mono text-xs">{command}</p>
|
||||
<CommandLineIcon width={24} height={24} />
|
||||
<CommandLineIcon width={16} height={16} />
|
||||
</StyledActionButton>
|
||||
|
||||
<ToolTip id={id} place="top">
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ export function OllamaStatus({ isOllamaConnected }: OllamaStatusProps) {
|
|||
return (
|
||||
<StyledActionButton onClick={onClickDownload}>
|
||||
<p className="mr-1 line-clamp-1 text-sm underline">{downloadUrl}</p>
|
||||
<ArrowTopRightOnSquareIcon width={24} height={24} />
|
||||
<ArrowTopRightOnSquareIcon width={16} height={16} />
|
||||
</StyledActionButton>
|
||||
);
|
||||
case OllamaConnectionStatuses.Downloading:
|
||||
|
|
@ -48,7 +48,7 @@ export function OllamaStatus({ isOllamaConnected }: OllamaStatusProps) {
|
|||
<p className="lines mr-1 w-3/4 font-mono text-sm">
|
||||
Checking for connection to Ollama at http://localhost:11434
|
||||
</p>
|
||||
<ArrowPathIcon className="animate-spin-slow mr-1 h-4 w-4" />
|
||||
<ArrowPathIcon className="animate-spin-slow mr-1 h-3 w-3" />
|
||||
</div>
|
||||
);
|
||||
case OllamaConnectionStatuses.Connected:
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { useState } from "react";
|
||||
import { useAuth } from "../../../context/Auth";
|
||||
import { useAppSelector } from "../../../redux/hooks";
|
||||
import { getLocalStorage, setLocalStorage } from "../../../util/localStorage";
|
||||
import Alert from "../../gui/Alert";
|
||||
|
|
@ -20,12 +21,21 @@ interface OnboardingCardProps {
|
|||
export function PlatformOnboardingCard({ isDialog }: OnboardingCardProps) {
|
||||
const onboardingCard = useOnboardingCard();
|
||||
const config = useAppSelector((store) => store.config.config);
|
||||
const auth = useAuth();
|
||||
const [currentTab, setCurrentTab] = useState<"main" | "local">("main");
|
||||
|
||||
if (getLocalStorage("onboardingStatus") === undefined) {
|
||||
setLocalStorage("onboardingStatus", "Started");
|
||||
}
|
||||
|
||||
function onGetStarted() {
|
||||
auth.login(true).then((success) => {
|
||||
if (success) {
|
||||
onboardingCard.close(isDialog);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return (
|
||||
<ReusableCard
|
||||
showCloseButton={!isDialog && !!config.modelsByRole.chat.length}
|
||||
|
|
@ -40,11 +50,10 @@ export function PlatformOnboardingCard({ isDialog }: OnboardingCardProps) {
|
|||
) : (
|
||||
<div className="mt-4 flex flex-col">
|
||||
<Alert type="info">
|
||||
By choosing this option, Continue will be configured by a local{" "}
|
||||
<code className="text-vsc-background">config.yaml</code> file. If
|
||||
you're just looking to use Ollama and still want to manage your
|
||||
configuration through Continue, click{" "}
|
||||
<a href="#" onClick={() => setCurrentTab("main")}>
|
||||
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{" "}
|
||||
<a href="#" onClick={onGetStarted}>
|
||||
here
|
||||
</a>
|
||||
</Alert>
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ export default function MainTab({
|
|||
</ButtonSubtext>
|
||||
) : (
|
||||
<ButtonSubtext onClick={onRemainLocal}>
|
||||
<div className="mt-4 flex cursor-pointer items-center justify-center gap-1">
|
||||
<div className="flex cursor-pointer items-center justify-center gap-1 hover:brightness-125">
|
||||
<span>Or, remain local</span>
|
||||
<ChevronRightIcon className="h-3 w-3" />
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -6,13 +6,12 @@ import {
|
|||
LOCAL_ONBOARDING_PROVIDER_TITLE,
|
||||
} from "core/config/onboarding";
|
||||
import { useContext, useEffect, useState } from "react";
|
||||
import { Button } from "../..";
|
||||
import { Button, ButtonSubtext } from "../..";
|
||||
import { useAuth } from "../../../context/Auth";
|
||||
import { IdeMessengerContext } from "../../../context/IdeMessenger";
|
||||
import { useAppDispatch } from "../../../redux/hooks";
|
||||
import { setDialogMessage, setShowDialog } from "../../../redux/slices/uiSlice";
|
||||
import { updateSelectedModelByRole } from "../../../redux/thunks";
|
||||
import AddModelButtonSubtext from "../../AddModelButtonSubtext";
|
||||
import OllamaModelDownload from "../components/OllamaModelDownload";
|
||||
import { OllamaStatus } from "../components/OllamaStatus";
|
||||
import { useSubmitOnboarding } from "../hooks";
|
||||
|
|
@ -102,10 +101,42 @@ function OnboardingLocalTab({ isDialog }: OnboardingLocalTabProps) {
|
|||
return () => clearInterval(intervalId);
|
||||
}, []);
|
||||
|
||||
const onClickSubmitOnboarding = () => {
|
||||
submitOnboarding();
|
||||
|
||||
if (isDialog) {
|
||||
dispatch(setDialogMessage(undefined));
|
||||
dispatch(setShowDialog(false));
|
||||
}
|
||||
|
||||
dispatch(
|
||||
updateSelectedModelByRole({
|
||||
selectedProfile,
|
||||
role: "chat",
|
||||
modelTitle: LOCAL_ONBOARDING_CHAT_TITLE,
|
||||
}),
|
||||
);
|
||||
};
|
||||
|
||||
const onClickSkip = () => {
|
||||
submitOnboarding();
|
||||
|
||||
ideMessenger.post("config/openProfile", {
|
||||
profileId: undefined,
|
||||
});
|
||||
|
||||
if (isDialog) {
|
||||
dispatch(setDialogMessage(undefined));
|
||||
dispatch(setShowDialog(false));
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="mt-3 flex flex-col gap-1 px-2">
|
||||
<div className="flex flex-col">
|
||||
<p className="mb-0 text-lg font-bold leading-tight">Install Ollama</p>
|
||||
<p className="mb-0 pb-1 text-base font-bold leading-tight">
|
||||
Install Ollama
|
||||
</p>
|
||||
<OllamaStatus isOllamaConnected={isOllamaConnected} />
|
||||
</div>
|
||||
|
||||
|
|
@ -129,28 +160,17 @@ function OnboardingLocalTab({ isDialog }: OnboardingLocalTabProps) {
|
|||
|
||||
<div className="mt-4 w-full">
|
||||
<Button
|
||||
onClick={() => {
|
||||
submitOnboarding();
|
||||
|
||||
if (isDialog) {
|
||||
dispatch(setDialogMessage(undefined));
|
||||
dispatch(setShowDialog(false));
|
||||
}
|
||||
|
||||
dispatch(
|
||||
updateSelectedModelByRole({
|
||||
selectedProfile,
|
||||
role: "chat",
|
||||
modelTitle: LOCAL_ONBOARDING_CHAT_TITLE,
|
||||
}),
|
||||
);
|
||||
}}
|
||||
onClick={onClickSubmitOnboarding}
|
||||
className="w-full"
|
||||
disabled={!allDownloaded}
|
||||
>
|
||||
Connect
|
||||
</Button>
|
||||
<AddModelButtonSubtext />
|
||||
<ButtonSubtext>
|
||||
<span className="cursor-pointer underline" onClick={onClickSkip}>
|
||||
Skip and configure manually
|
||||
</span>
|
||||
</ButtonSubtext>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
2
package-lock.json
generated
2
package-lock.json
generated
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"name": "continue",
|
||||
"name": "continue-fork",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue