feat: open lump on submit onboarding
This commit is contained in:
parent
fc2df6ce58
commit
f77f662c6e
10 changed files with 156 additions and 106 deletions
|
|
@ -1,3 +1,9 @@
|
|||
---
|
||||
title: Apply Role
|
||||
description: Apply model role
|
||||
keywords: [apply, model, role]
|
||||
---
|
||||
|
||||
When editing code, Chat and Edit model output often doesn't clearly align with existing code. A model with the `apply` role is used to generate a more precise diff to apply changes to a file.
|
||||
|
||||
## Recommended Apply models
|
||||
|
|
|
|||
8
gui/package-lock.json
generated
8
gui/package-lock.json
generated
|
|
@ -8,7 +8,6 @@
|
|||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@continuedev/config-yaml": "file:../packages/config-yaml",
|
||||
"@continuedev/llm-info": "file:../packages/llm-info",
|
||||
"@headlessui/react": "^2.2.0",
|
||||
"@heroicons/react": "^2.0.18",
|
||||
"@reduxjs/toolkit": "^2.3.0",
|
||||
|
|
@ -39,7 +38,7 @@
|
|||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-error-boundary": "^4.0.11",
|
||||
"react-hook-form": "^7.57.0",
|
||||
"react-hook-form": "^7.47.0",
|
||||
"react-intersection-observer": "^9.13.1",
|
||||
"react-markdown": "^9.0.1",
|
||||
"react-redux": "^8.0.5",
|
||||
|
|
@ -236,6 +235,7 @@
|
|||
"../packages/llm-info": {
|
||||
"name": "@continuedev/llm-info",
|
||||
"version": "1.0.9",
|
||||
"extraneous": true,
|
||||
"license": "Apache-2.0",
|
||||
"devDependencies": {
|
||||
"@types/node": "^22.15.29",
|
||||
|
|
@ -586,10 +586,6 @@
|
|||
"resolved": "../packages/config-yaml",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@continuedev/llm-info": {
|
||||
"resolved": "../packages/llm-info",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@emotion/is-prop-valid": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-1.3.1.tgz",
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@continuedev/config-yaml": "file:../packages/config-yaml",
|
||||
"@continuedev/llm-info": "file:../packages/llm-info",
|
||||
"@headlessui/react": "^2.2.0",
|
||||
"@heroicons/react": "^2.0.18",
|
||||
"@reduxjs/toolkit": "^2.3.0",
|
||||
|
|
@ -48,7 +47,7 @@
|
|||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-error-boundary": "^4.0.11",
|
||||
"react-hook-form": "^7.57.0",
|
||||
"react-hook-form": "^7.47.0",
|
||||
"react-intersection-observer": "^9.13.1",
|
||||
"react-markdown": "^9.0.1",
|
||||
"react-redux": "^8.0.5",
|
||||
|
|
|
|||
|
|
@ -14,14 +14,13 @@ import { enterEdit, exitEdit } from "../redux/thunks/edit";
|
|||
import { saveCurrentSession } from "../redux/thunks/session";
|
||||
import { fontSize, isMetaEquivalentKeyPressed } from "../util";
|
||||
import { incrementFreeTrialCount } from "../util/freeTrial";
|
||||
import { getLocalStorage } from "../util/localStorage";
|
||||
import { ROUTES } from "../util/navigation";
|
||||
import { FatalErrorIndicator } from "./config/FatalErrorNotice";
|
||||
import TextDialog from "./dialogs";
|
||||
import Footer from "./Footer";
|
||||
import { LumpProvider } from "./mainInput/Lump/LumpContext";
|
||||
import { useMainEditor } from "./mainInput/TipTapEditor";
|
||||
import { useOnboardingCard } from "./OnboardingCard";
|
||||
import { isNewUserOnboarding, useOnboardingCard } from "./OnboardingCard";
|
||||
import OSRContextMenu from "./OSRContextMenu";
|
||||
import PostHogPageView from "./PosthogPageView";
|
||||
|
||||
|
|
@ -197,7 +196,7 @@ const Layout = () => {
|
|||
|
||||
useEffect(() => {
|
||||
if (
|
||||
!getLocalStorage("onboardingStatus") &&
|
||||
isNewUserOnboarding() &&
|
||||
(location.pathname === "/" || location.pathname === "/index.html")
|
||||
) {
|
||||
onboardingCard.open();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
import { OnboardingModes } from "core/protocol/core";
|
||||
import { FormProvider, useForm } from "react-hook-form";
|
||||
import { AddModelForm } from "../../../forms";
|
||||
import { providers } from "../../../pages/AddNewModel/configs/providers";
|
||||
import { useAppDispatch } from "../../../redux/hooks";
|
||||
import { setDialogMessage, setShowDialog } from "../../../redux/slices/uiSlice";
|
||||
import { Button, Input } from "../../index";
|
||||
import { useSubmitOnboarding } from "../hooks/useSubmitOnboarding";
|
||||
|
||||
|
|
@ -13,6 +16,7 @@ export function OnboardingProvidersTab({
|
|||
isDialog,
|
||||
}: OnboardingProvidersTabProps) {
|
||||
const formMethods = useForm();
|
||||
const dispatch = useAppDispatch();
|
||||
const { submitOnboarding } = useSubmitOnboarding(
|
||||
OnboardingModes.PROVIDERS,
|
||||
isDialog,
|
||||
|
|
@ -35,6 +39,20 @@ export function OnboardingProvidersTab({
|
|||
}
|
||||
};
|
||||
|
||||
const handleClickMoreProviders = () => {
|
||||
dispatch(setShowDialog(true));
|
||||
dispatch(
|
||||
setDialogMessage(
|
||||
<AddModelForm
|
||||
onDone={() => {
|
||||
dispatch(setShowDialog(false));
|
||||
submitOnboarding();
|
||||
}}
|
||||
/>,
|
||||
),
|
||||
);
|
||||
};
|
||||
|
||||
const hasAnyApiKey = providerConfigs.some((config) => {
|
||||
const apiKey = formMethods.watch(`${config?.provider}_apiKey`);
|
||||
return apiKey?.trim();
|
||||
|
|
@ -92,7 +110,12 @@ export function OnboardingProvidersTab({
|
|||
|
||||
<div className="w-full text-center">
|
||||
<span className="text-description-muted">
|
||||
<span className="cursor-pointer underline">Click here</span>{" "}
|
||||
<span
|
||||
className="cursor-pointer underline hover:brightness-125"
|
||||
onClick={handleClickMoreProviders}
|
||||
>
|
||||
Click here
|
||||
</span>{" "}
|
||||
to view more providers
|
||||
</span>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -3,12 +3,14 @@ import { usePostHog } from "posthog-js/react";
|
|||
import { useContext } from "react";
|
||||
import { IdeMessengerContext } from "../../../context/IdeMessenger";
|
||||
import { getLocalStorage, setLocalStorage } from "../../../util/localStorage";
|
||||
import { useLump } from "../../mainInput/Lump/LumpContext";
|
||||
import { useOnboardingCard } from "./useOnboardingCard";
|
||||
|
||||
export function useSubmitOnboarding(mode: OnboardingModes, isDialog = false) {
|
||||
const posthog = usePostHog();
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
const { close: closeOnboardingCard } = useOnboardingCard();
|
||||
const { setSelectedSection } = useLump();
|
||||
|
||||
function submitOnboarding(provider?: string, apiKey?: string) {
|
||||
const onboardingStatus = getLocalStorage("onboardingStatus");
|
||||
|
|
@ -37,6 +39,7 @@ export function useSubmitOnboarding(mode: OnboardingModes, isDialog = false) {
|
|||
}
|
||||
|
||||
ideMessenger.post("config/openProfile", { profileId: undefined });
|
||||
setSelectedSection("models");
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -2,9 +2,14 @@ import { OnboardingModes } from "core/protocol/core";
|
|||
import { getLocalStorage, setLocalStorage } from "../../util/localStorage";
|
||||
import { OnboardingCardState } from "./OnboardingCard";
|
||||
|
||||
// Note that there is no "NotStarted" status since the
|
||||
// local storage value is null until onboarding begins
|
||||
export type OnboardingStatus = "Started" | "Completed";
|
||||
|
||||
// If there is no value in local storage for "onboardingStatus",
|
||||
// it implies that the user has not begun or completed onboarding.
|
||||
export function isNewUserOnboarding() {
|
||||
// We used to use "onboardingComplete", but switched to "onboardingStatus"
|
||||
const onboardingCompleteLegacyValue =
|
||||
localStorage.getItem("onboardingComplete");
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ export function ModelsSection() {
|
|||
return;
|
||||
}
|
||||
|
||||
dispatch(
|
||||
void dispatch(
|
||||
updateSelectedModelByRole({
|
||||
role,
|
||||
selectedProfile,
|
||||
|
|
@ -37,6 +37,7 @@ export function ModelsSection() {
|
|||
models={config.modelsByRole.chat}
|
||||
selectedModel={config.selectedModelByRole.chat}
|
||||
onSelect={(model) => handleRoleUpdate("chat", model)}
|
||||
setupURL="https://docs.continue.dev/chat/model-setup"
|
||||
/>
|
||||
<ModelRoleSelector
|
||||
displayName="Autocomplete"
|
||||
|
|
@ -44,6 +45,7 @@ export function ModelsSection() {
|
|||
models={config.modelsByRole.autocomplete}
|
||||
selectedModel={config.selectedModelByRole.autocomplete}
|
||||
onSelect={(model) => handleRoleUpdate("autocomplete", model)}
|
||||
setupURL="https://docs.continue.dev/autocomplete/model-setup"
|
||||
/>
|
||||
{/* Jetbrains has a model selector inline */}
|
||||
{!jetbrains && (
|
||||
|
|
@ -53,6 +55,7 @@ export function ModelsSection() {
|
|||
models={config.modelsByRole.edit}
|
||||
selectedModel={config.selectedModelByRole.edit}
|
||||
onSelect={(model) => handleRoleUpdate("edit", model)}
|
||||
setupURL="https://docs.continue.dev/edit/model-setup"
|
||||
/>
|
||||
)}
|
||||
<ModelRoleSelector
|
||||
|
|
@ -61,6 +64,7 @@ export function ModelsSection() {
|
|||
models={config.modelsByRole.apply}
|
||||
selectedModel={config.selectedModelByRole.apply}
|
||||
onSelect={(model) => handleRoleUpdate("apply", model)}
|
||||
setupURL="https://docs.continue.dev/customize/model-roles/apply"
|
||||
/>
|
||||
<ModelRoleSelector
|
||||
displayName="Embed"
|
||||
|
|
@ -68,6 +72,7 @@ export function ModelsSection() {
|
|||
models={config.modelsByRole.embed}
|
||||
selectedModel={config.selectedModelByRole.embed}
|
||||
onSelect={(model) => handleRoleUpdate("embed", model)}
|
||||
setupURL="https://docs.continue.dev/customize/model-roles/embeddings"
|
||||
/>
|
||||
<ModelRoleSelector
|
||||
displayName="Rerank"
|
||||
|
|
@ -75,6 +80,7 @@ export function ModelsSection() {
|
|||
models={config.modelsByRole.rerank}
|
||||
selectedModel={config.selectedModelByRole.rerank}
|
||||
onSelect={(model) => handleRoleUpdate("rerank", model)}
|
||||
setupURL="https://docs.continue.dev/customize/model-roles/reranking"
|
||||
/>
|
||||
</div>
|
||||
<ExploreBlocksButton blockType={"models"} />
|
||||
|
|
|
|||
|
|
@ -232,8 +232,8 @@ function ModelSelect() {
|
|||
|
||||
<div className="no-scrollbar max-h-[300px] overflow-y-auto">
|
||||
{isConfigLoading ? (
|
||||
<div className="flex items-center justify-center gap-2 px-2 py-4 text-sm">
|
||||
<ArrowPathIcon className="h-3 w-3 animate-spin" />
|
||||
<div className="text-description flex items-center gap-2 px-2 pb-2 pt-1 text-xs">
|
||||
<ArrowPathIcon className="animate-spin-slow h-3 w-3" />
|
||||
<span>Loading config</span>
|
||||
</div>
|
||||
) : hasNoModels ? (
|
||||
|
|
@ -272,12 +272,14 @@ function ModelSelect() {
|
|||
</ListboxOption>
|
||||
)}
|
||||
|
||||
<div
|
||||
className="text-description-muted px-2 py-1"
|
||||
style={{ fontSize: fontSize(-3) }}
|
||||
>
|
||||
<code>{getMetaKeyLabel()}'</code> to toggle model
|
||||
</div>
|
||||
{!isConfigLoading && (
|
||||
<div
|
||||
className="text-description-muted px-2 py-1"
|
||||
style={{ fontSize: fontSize(-3) }}
|
||||
>
|
||||
<code>{getMetaKeyLabel()}'</code> to toggle model
|
||||
</div>
|
||||
)}
|
||||
</ListboxOptions>
|
||||
</div>
|
||||
</Listbox>
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ interface ModelRoleSelectorProps {
|
|||
onSelect: (model: ModelDescription | null) => void;
|
||||
displayName: string;
|
||||
description: string;
|
||||
setupURL: string;
|
||||
}
|
||||
|
||||
const ModelRoleSelector = ({
|
||||
|
|
@ -34,6 +35,7 @@ const ModelRoleSelector = ({
|
|||
onSelect,
|
||||
displayName,
|
||||
description,
|
||||
setupURL,
|
||||
}: ModelRoleSelectorProps) => {
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
const [hoveredIdx, setHoveredIdx] = useState<number | null>(null);
|
||||
|
|
@ -65,102 +67,111 @@ const ModelRoleSelector = ({
|
|||
return (
|
||||
<>
|
||||
<div className="mt-2 flex flex-row items-center gap-1 sm:mt-0">
|
||||
<span
|
||||
style={{
|
||||
fontSize: fontSize(-3),
|
||||
}}
|
||||
>
|
||||
{displayName}
|
||||
</span>
|
||||
<span style={{ fontSize: fontSize(-3) }}>{displayName}</span>
|
||||
<InfoHover size="3" id={displayName} msg={description} />
|
||||
<ToolTip id={`${displayName}-description`} place={"bottom"}>
|
||||
{description}
|
||||
</ToolTip>
|
||||
</div>
|
||||
|
||||
<Listbox value={selectedModel?.title ?? null} onChange={handleSelect}>
|
||||
<div className="relative">
|
||||
<ListboxButton
|
||||
disabled={models.length === 0}
|
||||
className={`bg-vsc-editor-background hover:bg-list-active hover:text-list-active-foreground w-full justify-between`}
|
||||
>
|
||||
{models.length === 0 || noConfiguredModels ? (
|
||||
<span className="text-lightgray line-clamp-1 italic">
|
||||
{`No ${models.length === 0 ? "" : "valid "}${displayName} models${
|
||||
["Chat", "Apply", "Edit"].includes(displayName)
|
||||
? ". Using Chat model"
|
||||
: ""
|
||||
}`}
|
||||
</span>
|
||||
) : (
|
||||
<span className="line-clamp-1">
|
||||
{selectedModel?.title ?? `Select ${displayName} model`}
|
||||
</span>
|
||||
)}
|
||||
{models.length ? (
|
||||
<div className="pointer-events-none flex items-center">
|
||||
<ChevronUpDownIcon className="h-3 w-3" aria-hidden="true" />
|
||||
</div>
|
||||
) : null}
|
||||
</ListboxButton>
|
||||
|
||||
<Transition>
|
||||
<ListboxOptions
|
||||
style={{ borderRadius: defaultBorderRadius }}
|
||||
className="min-w-40"
|
||||
{models.length === 0 ? (
|
||||
<ListboxButton
|
||||
onClick={() => ideMessenger.post("openUrl", setupURL)}
|
||||
className="bg-vsc-editor-background hover:bg-list-active hover:text-list-active-foreground text-description w-full justify-between px-2 py-1 underline hover:underline"
|
||||
>
|
||||
{[...models]
|
||||
.sort((a, b) => a.title.localeCompare(b.title))
|
||||
.map((option, idx) => {
|
||||
const showMissingApiKeyMsg =
|
||||
option.configurationStatus ===
|
||||
LLMConfigurationStatuses.MISSING_API_KEY;
|
||||
<span className="line-clamp-1" style={{ fontSize: fontSize(-3) }}>
|
||||
Setup a {displayName} model
|
||||
</span>
|
||||
</ListboxButton>
|
||||
) : (
|
||||
<>
|
||||
<ListboxButton
|
||||
disabled={models.length === 0}
|
||||
className="bg-vsc-editor-background hover:bg-list-active hover:text-list-active-foreground w-full justify-between px-2 py-1"
|
||||
>
|
||||
{models.length === 0 || noConfiguredModels ? (
|
||||
<span className="text-lightgray line-clamp-1 italic">
|
||||
{`No ${models.length === 0 ? "" : "valid "}${displayName} models${
|
||||
["Chat", "Apply", "Edit"].includes(displayName)
|
||||
? ". Using Chat model"
|
||||
: ""
|
||||
}`}
|
||||
</span>
|
||||
) : (
|
||||
<span className="line-clamp-1">
|
||||
{selectedModel?.title ?? `Select ${displayName} model`}
|
||||
</span>
|
||||
)}
|
||||
|
||||
return (
|
||||
<ListboxOption
|
||||
key={idx}
|
||||
value={option.title}
|
||||
disabled={showMissingApiKeyMsg}
|
||||
onMouseEnter={() => setHoveredIdx(idx)}
|
||||
onMouseLeave={() => setHoveredIdx(null)}
|
||||
onClick={(e: any) =>
|
||||
handleOptionClick(showMissingApiKeyMsg, e)
|
||||
}
|
||||
className={""}
|
||||
>
|
||||
<div className="flex flex-col gap-0.5">
|
||||
<div className="flex flex-1 flex-row items-center justify-between gap-2">
|
||||
<div className="flex flex-1 flex-row items-center gap-2">
|
||||
<CubeIcon className="h-3 w-3 flex-shrink-0" />
|
||||
<span
|
||||
className="line-clamp-1 flex-1"
|
||||
style={{ fontSize: fontSize(-3) }}
|
||||
>
|
||||
{option.title}
|
||||
{showMissingApiKeyMsg && (
|
||||
<span className="ml-2 text-[10px] italic">
|
||||
(Missing API key)
|
||||
{models.length > 0 && (
|
||||
<div className="pointer-events-none flex items-center">
|
||||
<ChevronUpDownIcon className="h-3 w-3" aria-hidden="true" />
|
||||
</div>
|
||||
)}
|
||||
</ListboxButton>
|
||||
<Transition>
|
||||
<ListboxOptions
|
||||
style={{ borderRadius: defaultBorderRadius }}
|
||||
className="min-w-40"
|
||||
>
|
||||
{[...models]
|
||||
.sort((a, b) => a.title.localeCompare(b.title))
|
||||
.map((option, idx) => {
|
||||
const showMissingApiKeyMsg =
|
||||
option.configurationStatus ===
|
||||
LLMConfigurationStatuses.MISSING_API_KEY;
|
||||
|
||||
return (
|
||||
<ListboxOption
|
||||
key={idx}
|
||||
value={option.title}
|
||||
disabled={showMissingApiKeyMsg}
|
||||
onMouseEnter={() => setHoveredIdx(idx)}
|
||||
onMouseLeave={() => setHoveredIdx(null)}
|
||||
onClick={(e: any) =>
|
||||
handleOptionClick(showMissingApiKeyMsg, e)
|
||||
}
|
||||
className=""
|
||||
>
|
||||
<div className="flex flex-col gap-0.5">
|
||||
<div className="flex flex-1 flex-row items-center justify-between gap-2">
|
||||
<div className="flex flex-1 flex-row items-center gap-2">
|
||||
<CubeIcon className="h-3 w-3 flex-shrink-0" />
|
||||
<span
|
||||
className="line-clamp-1 flex-1"
|
||||
style={{ fontSize: fontSize(-3) }}
|
||||
>
|
||||
{option.title}
|
||||
{showMissingApiKeyMsg && (
|
||||
<span className="ml-2 text-[10px] italic">
|
||||
(Missing API key)
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-shrink-0 flex-row items-center gap-1">
|
||||
{hoveredIdx === idx && (
|
||||
<Cog6ToothIcon
|
||||
className="h-3 w-3 flex-shrink-0"
|
||||
onClick={onClickGear}
|
||||
/>
|
||||
)}
|
||||
{option.title === selectedModel?.title && (
|
||||
<CheckIcon className="h-3 w-3 flex-shrink-0" />
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex flex-shrink-0 flex-row items-center gap-1">
|
||||
{hoveredIdx === idx && (
|
||||
<Cog6ToothIcon
|
||||
className="h-3 w-3 flex-shrink-0"
|
||||
onClick={onClickGear}
|
||||
/>
|
||||
)}
|
||||
{option.title === selectedModel?.title && (
|
||||
<CheckIcon className="h-3 w-3 flex-shrink-0" />
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ListboxOption>
|
||||
);
|
||||
})}
|
||||
</ListboxOptions>
|
||||
</Transition>
|
||||
</ListboxOption>
|
||||
);
|
||||
})}
|
||||
</ListboxOptions>
|
||||
</Transition>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</Listbox>
|
||||
</>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue