feat: allow users to skip local onboaridng
This commit is contained in:
parent
880f1de80d
commit
4685db02b8
6 changed files with 49 additions and 43 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,14 +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 SkipLocalOnboardingSubtext from "../../SkipLocalOnboardingSubtext";
|
||||
import OllamaModelDownload from "../components/OllamaModelDownload";
|
||||
import { OllamaStatus } from "../components/OllamaStatus";
|
||||
import { useSubmitOnboarding } from "../hooks";
|
||||
|
|
@ -118,12 +116,27 @@ function OnboardingLocalTab({ isDialog }: OnboardingLocalTabProps) {
|
|||
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>
|
||||
|
||||
|
|
@ -145,7 +158,6 @@ function OnboardingLocalTab({ isDialog }: OnboardingLocalTabProps) {
|
|||
hasDownloaded={hasDownloadedEmbeddingsModel}
|
||||
/>
|
||||
|
||||
|
||||
<div className="mt-4 w-full">
|
||||
<Button
|
||||
onClick={onClickSubmitOnboarding}
|
||||
|
|
@ -154,8 +166,11 @@ function OnboardingLocalTab({ isDialog }: OnboardingLocalTabProps) {
|
|||
>
|
||||
Connect
|
||||
</Button>
|
||||
<AddModelButtonSubtext />
|
||||
<SkipLocalOnboardingSubtext onClick={onClickSubmitOnboarding} />
|
||||
<ButtonSubtext>
|
||||
<span className="cursor-pointer underline" onClick={onClickSkip}>
|
||||
Skip and configure manually
|
||||
</span>
|
||||
</ButtonSubtext>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,22 +0,0 @@
|
|||
import { ButtonSubtext } from ".";
|
||||
|
||||
export interface SkipLocalOnboardingSubtextProps {
|
||||
onClick: () => void
|
||||
}
|
||||
|
||||
function SkipLocalOnboardingSubtext({
|
||||
onClick,
|
||||
}: SkipLocalOnboardingSubtextProps) {
|
||||
return (
|
||||
<ButtonSubtext>
|
||||
<span
|
||||
className="cursor-pointer underline"
|
||||
onClick={onClick}
|
||||
>
|
||||
proceed without checks
|
||||
</span>
|
||||
</ButtonSubtext>
|
||||
);
|
||||
}
|
||||
|
||||
export default SkipLocalOnboardingSubtext;
|
||||
Loading…
Add table
Reference in a new issue