From 8eca6d3cf5c9aaaa76fd442471aca23f51ed0da8 Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 12 Aug 2025 20:43:08 -0400 Subject: [PATCH] add model button in settings page --- .../Lump/sections/ExploreBlocksButton.tsx | 64 ++++++++----------- .../mainInput/Lump/sections/ModelsSection.tsx | 32 +++++++++- gui/src/pages/config/index.tsx | 12 ++-- 3 files changed, 62 insertions(+), 46 deletions(-) diff --git a/gui/src/components/mainInput/Lump/sections/ExploreBlocksButton.tsx b/gui/src/components/mainInput/Lump/sections/ExploreBlocksButton.tsx index 532fc030b..94cc798e5 100644 --- a/gui/src/components/mainInput/Lump/sections/ExploreBlocksButton.tsx +++ b/gui/src/components/mainInput/Lump/sections/ExploreBlocksButton.tsx @@ -1,13 +1,9 @@ import { BlockType } from "@continuedev/config-yaml"; -import { - ArrowTopRightOnSquareIcon, - PlusIcon, -} from "@heroicons/react/24/outline"; import { useContext } from "react"; -import { GhostButton } from "../../.."; import { useAuth } from "../../../../context/Auth"; import { IdeMessengerContext } from "../../../../context/IdeMessenger"; -import { fontSize } from "../../../../util"; +import { BaseIconButton } from "./BaseIconButton"; +import { getExploreBlocksConfig } from "./exploreBlocksLogic"; export function ExploreBlocksButton(props: { blockType: string }) { const { selectedProfile } = useAuth(); @@ -15,41 +11,31 @@ export function ExploreBlocksButton(props: { blockType: string }) { const isLocal = selectedProfile?.profileType === "local"; - const Icon = isLocal ? PlusIcon : ArrowTopRightOnSquareIcon; - const text = `${isLocal ? "Add" : "Explore"} ${ - props.blockType === "mcpServers" - ? "MCP Servers" - : props.blockType.charAt(0).toUpperCase() + props.blockType.slice(1) - }`; - - const handleClick = () => { - if (isLocal) { - void ideMessenger.request("config/addLocalWorkspaceBlock", { - blockType: props.blockType as BlockType, - }); - } else { - void ideMessenger.request("controlPlane/openUrl", { - path: `new?type=block&blockType=${props.blockType}`, - orgSlug: undefined, - }); - } + const handleLocalAdd = (blockType: BlockType) => { + void ideMessenger.request("config/addLocalWorkspaceBlock", { + blockType, + }); }; + const handleExplore = (blockType: string) => { + void ideMessenger.request("controlPlane/openUrl", { + path: `new?type=block&blockType=${blockType}`, + orgSlug: undefined, + }); + }; + + const config = getExploreBlocksConfig( + props.blockType, + isLocal, + handleLocalAdd, + handleExplore + ); + return ( - { - e.preventDefault(); - handleClick(); - }} - > -
- - {text} -
-
+ ); } diff --git a/gui/src/components/mainInput/Lump/sections/ModelsSection.tsx b/gui/src/components/mainInput/Lump/sections/ModelsSection.tsx index b8327d59e..ff93eecf6 100644 --- a/gui/src/components/mainInput/Lump/sections/ModelsSection.tsx +++ b/gui/src/components/mainInput/Lump/sections/ModelsSection.tsx @@ -1,10 +1,14 @@ import { ModelRole } from "@continuedev/config-yaml"; +import { PlusIcon } from "@heroicons/react/24/outline"; import { ModelDescription } from "core"; import { useAuth } from "../../../../context/Auth"; +import { AddModelForm } from "../../../../forms/AddModelForm"; import ModelRoleSelector from "../../../../pages/config/ModelRoleSelector"; import { useAppDispatch, useAppSelector } from "../../../../redux/hooks"; +import { setDialogMessage, setShowDialog } from "../../../../redux/slices/uiSlice"; import { updateSelectedModelByRole } from "../../../../redux/thunks/updateSelectedModelByRole"; import { isJetBrains } from "../../../../util"; +import { BaseIconButton } from "./BaseIconButton"; export function ModelsSection() { const { selectedProfile } = useAuth(); @@ -27,9 +31,25 @@ export function ModelsSection() { ); } + function handleAddModel(e: React.MouseEvent) { + e.stopPropagation(); + e.preventDefault(); + + dispatch(setShowDialog(true)); + dispatch( + setDialogMessage( + { + dispatch(setShowDialog(false)); + }} + />, + ), + ); + } + return (
-
+
+ + {selectedProfile?.profileType === "local" && ( +
+ +
+ )}
); } diff --git a/gui/src/pages/config/index.tsx b/gui/src/pages/config/index.tsx index 950b3e474..74035952a 100644 --- a/gui/src/pages/config/index.tsx +++ b/gui/src/pages/config/index.tsx @@ -86,6 +86,12 @@ function ConfigPage() { // ), // icon: , // }, + { + id: "mcp", + label: "MCP", + component: , + icon: , + }, { id: "tools", label: "Tools", @@ -99,12 +105,6 @@ function ConfigPage() { ), }, - { - id: "mcp", - label: "MCP", - component: , - icon: , - }, { id: "indexing", label: "Indexing",