From f77f662c6e7313db645656e003c9d0145646388e Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Sun, 8 Jun 2025 11:08:58 -0700 Subject: [PATCH] feat: open lump on submit onboarding --- docs/docs/customize/model-roles/apply.mdx | 6 + gui/package-lock.json | 8 +- gui/package.json | 3 +- gui/src/components/Layout.tsx | 5 +- .../components/OnboardingProvidersTab.tsx | 25 ++- .../hooks/useSubmitOnboarding.ts | 3 + gui/src/components/OnboardingCard/utils.ts | 5 + .../mainInput/Lump/sections/ModelsSection.tsx | 8 +- .../components/modelSelection/ModelSelect.tsx | 18 +- gui/src/pages/config/ModelRoleSelector.tsx | 181 ++++++++++-------- 10 files changed, 156 insertions(+), 106 deletions(-) diff --git a/docs/docs/customize/model-roles/apply.mdx b/docs/docs/customize/model-roles/apply.mdx index 6cce4acbc..f4e35ce05 100644 --- a/docs/docs/customize/model-roles/apply.mdx +++ b/docs/docs/customize/model-roles/apply.mdx @@ -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 diff --git a/gui/package-lock.json b/gui/package-lock.json index 87b96c1ab..a985e6c29 100644 --- a/gui/package-lock.json +++ b/gui/package-lock.json @@ -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", diff --git a/gui/package.json b/gui/package.json index bb3f21e11..de6da1959 100644 --- a/gui/package.json +++ b/gui/package.json @@ -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", diff --git a/gui/src/components/Layout.tsx b/gui/src/components/Layout.tsx index 86bb0cf0d..811297e81 100644 --- a/gui/src/components/Layout.tsx +++ b/gui/src/components/Layout.tsx @@ -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(); diff --git a/gui/src/components/OnboardingCard/components/OnboardingProvidersTab.tsx b/gui/src/components/OnboardingCard/components/OnboardingProvidersTab.tsx index 3ccff0fa6..348acd475 100644 --- a/gui/src/components/OnboardingCard/components/OnboardingProvidersTab.tsx +++ b/gui/src/components/OnboardingCard/components/OnboardingProvidersTab.tsx @@ -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( + { + 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({
- Click here{" "} + + Click here + {" "} to view more providers
diff --git a/gui/src/components/OnboardingCard/hooks/useSubmitOnboarding.ts b/gui/src/components/OnboardingCard/hooks/useSubmitOnboarding.ts index da4c1953e..259dd6392 100644 --- a/gui/src/components/OnboardingCard/hooks/useSubmitOnboarding.ts +++ b/gui/src/components/OnboardingCard/hooks/useSubmitOnboarding.ts @@ -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 { diff --git a/gui/src/components/OnboardingCard/utils.ts b/gui/src/components/OnboardingCard/utils.ts index 690444097..dbd805210 100644 --- a/gui/src/components/OnboardingCard/utils.ts +++ b/gui/src/components/OnboardingCard/utils.ts @@ -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"); diff --git a/gui/src/components/mainInput/Lump/sections/ModelsSection.tsx b/gui/src/components/mainInput/Lump/sections/ModelsSection.tsx index b128db0a2..becf95cfd 100644 --- a/gui/src/components/mainInput/Lump/sections/ModelsSection.tsx +++ b/gui/src/components/mainInput/Lump/sections/ModelsSection.tsx @@ -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" /> 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" /> )} handleRoleUpdate("apply", model)} + setupURL="https://docs.continue.dev/customize/model-roles/apply" /> handleRoleUpdate("embed", model)} + setupURL="https://docs.continue.dev/customize/model-roles/embeddings" /> handleRoleUpdate("rerank", model)} + setupURL="https://docs.continue.dev/customize/model-roles/reranking" /> diff --git a/gui/src/components/modelSelection/ModelSelect.tsx b/gui/src/components/modelSelection/ModelSelect.tsx index 15a979668..c6f946b89 100644 --- a/gui/src/components/modelSelection/ModelSelect.tsx +++ b/gui/src/components/modelSelection/ModelSelect.tsx @@ -232,8 +232,8 @@ function ModelSelect() {
{isConfigLoading ? ( -
- +
+ Loading config
) : hasNoModels ? ( @@ -272,12 +272,14 @@ function ModelSelect() { )} -
- {getMetaKeyLabel()}' to toggle model -
+ {!isConfigLoading && ( +
+ {getMetaKeyLabel()}' to toggle model +
+ )}
diff --git a/gui/src/pages/config/ModelRoleSelector.tsx b/gui/src/pages/config/ModelRoleSelector.tsx index 2214853a4..25fb7b358 100644 --- a/gui/src/pages/config/ModelRoleSelector.tsx +++ b/gui/src/pages/config/ModelRoleSelector.tsx @@ -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(null); @@ -65,102 +67,111 @@ const ModelRoleSelector = ({ return ( <>
- - {displayName} - + {displayName} {description}
+
- - {models.length === 0 || noConfiguredModels ? ( - - {`No ${models.length === 0 ? "" : "valid "}${displayName} models${ - ["Chat", "Apply", "Edit"].includes(displayName) - ? ". Using Chat model" - : "" - }`} - - ) : ( - - {selectedModel?.title ?? `Select ${displayName} model`} - - )} - {models.length ? ( -
-
- ) : null} -
- - - 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; + + Setup a {displayName} model + + + ) : ( + <> + + {models.length === 0 || noConfiguredModels ? ( + + {`No ${models.length === 0 ? "" : "valid "}${displayName} models${ + ["Chat", "Apply", "Edit"].includes(displayName) + ? ". Using Chat model" + : "" + }`} + + ) : ( + + {selectedModel?.title ?? `Select ${displayName} model`} + + )} - return ( - setHoveredIdx(idx)} - onMouseLeave={() => setHoveredIdx(null)} - onClick={(e: any) => - handleOptionClick(showMissingApiKeyMsg, e) - } - className={""} - > -
-
-
- - - {option.title} - {showMissingApiKeyMsg && ( - - (Missing API key) + {models.length > 0 && ( +
+
+ )} + + + + {[...models] + .sort((a, b) => a.title.localeCompare(b.title)) + .map((option, idx) => { + const showMissingApiKeyMsg = + option.configurationStatus === + LLMConfigurationStatuses.MISSING_API_KEY; + + return ( + setHoveredIdx(idx)} + onMouseLeave={() => setHoveredIdx(null)} + onClick={(e: any) => + handleOptionClick(showMissingApiKeyMsg, e) + } + className="" + > +
+
+
+ + + {option.title} + {showMissingApiKeyMsg && ( + + (Missing API key) + + )} - )} - +
+ +
+ {hoveredIdx === idx && ( + + )} + {option.title === selectedModel?.title && ( + + )} +
+
-
- {hoveredIdx === idx && ( - - )} - {option.title === selectedModel?.title && ( - - )} -
-
-
- - ); - })} - - + + ); + })} + + + + )}