From b496e82832e75bb524fee6bbac6243784137ceb7 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Tue, 1 Apr 2025 16:29:56 -0700 Subject: [PATCH 1/5] fix lump toolbar --- .../components/mainInput/ContinueInputBox.tsx | 8 +- gui/src/components/mainInput/InputToolbar.tsx | 4 +- .../InputToolbar/{bottom => }/HoverItem.tsx | 0 .../{bottom => }/ToolDropdownItem.tsx | 8 +- .../{bottom => }/ToolPermissionsDialog.tsx | 8 +- .../InputToolbar/top/TopInputToolbar.tsx | 22 -- .../Lump/BlockSettingsTopToolbar.tsx | 4 +- gui/src/components/mainInput/Lump/index.tsx | 48 ++- .../mainInput/Lump/sections/ToolsSection.tsx | 2 +- .../mainInput/tiptap/TipTapEditor.tsx | 4 - .../platform/AssistantSelect.tsx | 35 +- gui/src/pages/config/UserSettingsForm.tsx | 335 +++++++++--------- 12 files changed, 237 insertions(+), 241 deletions(-) rename gui/src/components/mainInput/InputToolbar/{bottom => }/HoverItem.tsx (100%) rename gui/src/components/mainInput/InputToolbar/{bottom => }/ToolDropdownItem.tsx (92%) rename gui/src/components/mainInput/InputToolbar/{bottom => }/ToolPermissionsDialog.tsx (90%) delete mode 100644 gui/src/components/mainInput/InputToolbar/top/TopInputToolbar.tsx diff --git a/gui/src/components/mainInput/ContinueInputBox.tsx b/gui/src/components/mainInput/ContinueInputBox.tsx index 2b91b707b..cf2b4cf46 100644 --- a/gui/src/components/mainInput/ContinueInputBox.tsx +++ b/gui/src/components/mainInput/ContinueInputBox.tsx @@ -1,6 +1,6 @@ import { Editor, JSONContent } from "@tiptap/react"; import { ContextItemWithId, InputModifiers } from "core"; -import { useMemo, useState } from "react"; +import { useMemo } from "react"; import styled, { keyframes } from "styled-components"; import { defaultBorderRadius, vscBackground } from ".."; import { useAppSelector } from "../../redux/hooks"; @@ -113,12 +113,10 @@ function ContinueInputBox(props: ContinueInputBoxProps) { } : {}; - const [lumpOpen, setLumpOpen] = useState(true); - return (
- {props.isMainInput && } + {props.isMainInput && } diff --git a/gui/src/components/mainInput/InputToolbar.tsx b/gui/src/components/mainInput/InputToolbar.tsx index de2c410f7..3d0a38cec 100644 --- a/gui/src/components/mainInput/InputToolbar.tsx +++ b/gui/src/components/mainInput/InputToolbar.tsx @@ -31,7 +31,7 @@ import { ToolTip } from "../gui/Tooltip"; import ModelSelect from "../modelSelection/ModelSelect"; import ModeSelect from "../modelSelection/ModeSelect"; import { useFontSize } from "../ui/font"; -import HoverItem from "./InputToolbar/bottom/HoverItem"; +import HoverItem from "./InputToolbar/HoverItem"; const StyledDiv = styled.div<{ isHidden?: boolean }>` padding-top: 4px; @@ -87,8 +87,6 @@ interface InputToolbarProps { toolbarOptions?: ToolbarOptions; disabled?: boolean; isMainInput?: boolean; - lumpOpen: boolean; - setLumpOpen: (open: boolean) => void; } function InputToolbar(props: InputToolbarProps) { diff --git a/gui/src/components/mainInput/InputToolbar/bottom/HoverItem.tsx b/gui/src/components/mainInput/InputToolbar/HoverItem.tsx similarity index 100% rename from gui/src/components/mainInput/InputToolbar/bottom/HoverItem.tsx rename to gui/src/components/mainInput/InputToolbar/HoverItem.tsx diff --git a/gui/src/components/mainInput/InputToolbar/bottom/ToolDropdownItem.tsx b/gui/src/components/mainInput/InputToolbar/ToolDropdownItem.tsx similarity index 92% rename from gui/src/components/mainInput/InputToolbar/bottom/ToolDropdownItem.tsx rename to gui/src/components/mainInput/InputToolbar/ToolDropdownItem.tsx index d607c3f2e..f02996140 100644 --- a/gui/src/components/mainInput/InputToolbar/bottom/ToolDropdownItem.tsx +++ b/gui/src/components/mainInput/InputToolbar/ToolDropdownItem.tsx @@ -2,10 +2,10 @@ import { InformationCircleIcon } from "@heroicons/react/24/outline"; import { Tool } from "core"; import { useEffect } from "react"; import { useDispatch } from "react-redux"; -import { useAppSelector } from "../../../../redux/hooks"; -import { addTool, toggleToolSetting } from "../../../../redux/slices/uiSlice"; -import { fontSize } from "../../../../util"; -import { ToolTip } from "../../../gui/Tooltip"; +import { useAppSelector } from "../../../redux/hooks"; +import { addTool, toggleToolSetting } from "../../../redux/slices/uiSlice"; +import { fontSize } from "../../../util"; +import { ToolTip } from "../../gui/Tooltip"; interface ToolDropdownItemProps { tool: Tool; diff --git a/gui/src/components/mainInput/InputToolbar/bottom/ToolPermissionsDialog.tsx b/gui/src/components/mainInput/InputToolbar/ToolPermissionsDialog.tsx similarity index 90% rename from gui/src/components/mainInput/InputToolbar/bottom/ToolPermissionsDialog.tsx rename to gui/src/components/mainInput/InputToolbar/ToolPermissionsDialog.tsx index 5ab7bfa45..a33208b55 100644 --- a/gui/src/components/mainInput/InputToolbar/bottom/ToolPermissionsDialog.tsx +++ b/gui/src/components/mainInput/InputToolbar/ToolPermissionsDialog.tsx @@ -1,9 +1,9 @@ import { Tool } from "core"; import { useMemo } from "react"; -import { useAppDispatch, useAppSelector } from "../../../../redux/hooks"; -import { toggleToolGroupSetting } from "../../../../redux/slices/uiSlice"; -import { fontSize } from "../../../../util"; -import ToggleSwitch from "../../../gui/Switch"; +import { useAppDispatch, useAppSelector } from "../../../redux/hooks"; +import { toggleToolGroupSetting } from "../../../redux/slices/uiSlice"; +import { fontSize } from "../../../util"; +import ToggleSwitch from "../../gui/Switch"; import ToolDropdownItem from "./ToolDropdownItem"; export const ToolPermissionsDialog = () => { diff --git a/gui/src/components/mainInput/InputToolbar/top/TopInputToolbar.tsx b/gui/src/components/mainInput/InputToolbar/top/TopInputToolbar.tsx deleted file mode 100644 index f82ea9860..000000000 --- a/gui/src/components/mainInput/InputToolbar/top/TopInputToolbar.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import { EllipsisHorizontalIcon } from "@heroicons/react/24/outline"; -import { ToolbarOptions } from "../../InputToolbar"; -import HoverItem from "../bottom/HoverItem"; - -interface TopInputToolbarProps { - toolbarOptions?: ToolbarOptions; - onAddContextItem?: () => void; - lumpOpen: boolean; - setLumpOpen: (open: boolean) => void; -} -export function TopInputToolbar(props: TopInputToolbarProps) { - return ( -
- props.setLumpOpen(!props.lumpOpen)} - className="ml-auto" - > - - -
- ); -} diff --git a/gui/src/components/mainInput/Lump/BlockSettingsTopToolbar.tsx b/gui/src/components/mainInput/Lump/BlockSettingsTopToolbar.tsx index edde8cd5d..dd4f2af94 100644 --- a/gui/src/components/mainInput/Lump/BlockSettingsTopToolbar.tsx +++ b/gui/src/components/mainInput/Lump/BlockSettingsTopToolbar.tsx @@ -13,7 +13,7 @@ import { useAppDispatch, useAppSelector } from "../../../redux/hooks"; import { toggleBlockSettingsToolbar } from "../../../redux/slices/uiSlice"; import { fontSize } from "../../../util"; import AssistantSelect from "../../modelSelection/platform/AssistantSelect"; -import HoverItem from "../InputToolbar/bottom/HoverItem"; +import HoverItem from "../InputToolbar/HoverItem"; interface BlockSettingsToolbarIcon { tooltip: string; @@ -129,7 +129,7 @@ export function BlockSettingsTopToolbar(props: BlockSettingsTopToolbarProps) {
-
+
diff --git a/gui/src/components/mainInput/Lump/index.tsx b/gui/src/components/mainInput/Lump/index.tsx index a642136b4..57276ad56 100644 --- a/gui/src/components/mainInput/Lump/index.tsx +++ b/gui/src/components/mainInput/Lump/index.tsx @@ -9,12 +9,7 @@ import { useAppSelector } from "../../../redux/hooks"; import { LumpToolbar } from "./LumpToolbar"; import { SelectedSection } from "./sections/SelectedSection"; -interface LumpProps { - open: boolean; - setOpen: (open: boolean) => void; -} - -const LumpDiv = styled.div<{ open: boolean }>` +const LumpDiv = styled.div` background-color: ${vscInputBackground}; margin-left: 4px; margin-right: 4px; @@ -35,33 +30,50 @@ const ContentDiv = styled.div<{ hasSection: boolean; isVisible: boolean }>` overflow-y: auto; `; -export function Lump(props: LumpProps) { - const { open, setOpen } = props; +export function Lump() { const [selectedSection, setSelectedSection] = useState(null); const [displayedSection, setDisplayedSection] = useState(null); const [isVisible, setIsVisible] = useState(false); const isStreaming = useAppSelector((state) => state.session.isStreaming); + useEffect(() => { + if (!selectedSection) { + return; + } + const handleKeyDown = (event: KeyboardEvent) => { + if (event.key === "Escape") { + setSelectedSection(null); + } + }; + document.addEventListener("keydown", handleKeyDown); + return () => { + document.removeEventListener("keydown", handleKeyDown); + }; + }, [selectedSection]); + + useEffect(() => { + if (isStreaming) { + setSelectedSection(null); + } + }, [isStreaming]); + useEffect(() => { if (selectedSection) { setDisplayedSection(selectedSection); setIsVisible(true); } else { setIsVisible(false); - // Delay clearing the displayed section until after the fade-out const timeout = setTimeout(() => { setDisplayedSection(null); - }, 300); // Match the transition duration - return () => clearTimeout(timeout); + }, 300); + return () => { + clearTimeout(timeout); + }; } }, [selectedSection]); - if (!open) { - return null; - } - return ( - +
- {!isStreaming && ( - - )} +
diff --git a/gui/src/components/mainInput/Lump/sections/ToolsSection.tsx b/gui/src/components/mainInput/Lump/sections/ToolsSection.tsx index af03f7220..920df276c 100644 --- a/gui/src/components/mainInput/Lump/sections/ToolsSection.tsx +++ b/gui/src/components/mainInput/Lump/sections/ToolsSection.tsx @@ -1,4 +1,4 @@ -import { ToolPermissionsDialog } from "../../InputToolbar/bottom/ToolPermissionsDialog"; +import { ToolPermissionsDialog } from "../../InputToolbar/ToolPermissionsDialog"; interface ToolsSectionProps {} diff --git a/gui/src/components/mainInput/tiptap/TipTapEditor.tsx b/gui/src/components/mainInput/tiptap/TipTapEditor.tsx index 47323e4ee..7a287660d 100644 --- a/gui/src/components/mainInput/tiptap/TipTapEditor.tsx +++ b/gui/src/components/mainInput/tiptap/TipTapEditor.tsx @@ -32,8 +32,6 @@ export interface TipTapEditorProps { ) => void; editorState?: JSONContent; toolbarOptions?: ToolbarOptions; - lumpOpen: boolean; - setLumpOpen: (open: boolean) => void; placeholder?: string; historyKey: string; inputId: string; @@ -262,8 +260,6 @@ function TipTapEditor(props: TipTapEditorProps) { activeKey={activeKey} hidden={shouldHideToolbar && !props.isMainInput} onAddContextItem={() => insertCharacterWithWhitespace("@")} - lumpOpen={props.lumpOpen} - setLumpOpen={props.setLumpOpen} onEnter={onEnterRef.current} onImageFileSelected={(file) => { handleImageFile(ideMessenger, file).then((result) => { diff --git a/gui/src/components/modelSelection/platform/AssistantSelect.tsx b/gui/src/components/modelSelection/platform/AssistantSelect.tsx index 151277c9a..b64b7306c 100644 --- a/gui/src/components/modelSelection/platform/AssistantSelect.tsx +++ b/gui/src/components/modelSelection/platform/AssistantSelect.tsx @@ -1,12 +1,13 @@ import { ArrowTopRightOnSquareIcon, BuildingOfficeIcon, + CheckIcon, ChevronDownIcon, Cog6ToothIcon, ExclamationTriangleIcon, PlusIcon, } from "@heroicons/react/24/outline"; -import { useContext, useEffect, useMemo, useRef, useState } from "react"; +import { useContext, useEffect, useMemo, useRef } from "react"; import { useAuth } from "../../../context/Auth"; import { IdeMessengerContext } from "../../../context/IdeMessenger"; import { cycleProfile, selectProfileThunk } from "../../../redux"; @@ -33,16 +34,24 @@ import { ToolTip } from "../../gui/Tooltip"; import { useFontSize } from "../../ui/font"; import AssistantIcon from "./AssistantIcon"; +// interface OpenAssistantConfigProps { +// profile: ProfileDescription +// } +// const OpenAssistantConfigIcon = ({ profile }: Opean) => { + +// } interface AssistantSelectOptionProps { profile: ProfileDescription; + selected: boolean; onClick: () => void; } + const AssistantSelectOption = ({ profile, + selected, onClick, }: AssistantSelectOptionProps) => { const navigate = useNavigate(); - const [hovered, setHovered] = useState(false); const hasFatalErrors = useMemo(() => { return !!profile.errors?.find((error) => error.fatal); @@ -72,8 +81,6 @@ const AssistantSelectOption = ({ return ( setHovered(true)} - onMouseLeave={() => setHovered(false)} value={profile.id} disabled={hasFatalErrors} onClick={!hasFatalErrors ? handleOptionClick : undefined} @@ -81,20 +88,22 @@ const AssistantSelectOption = ({ >
-
+
- {profile.title} + + {profile.title} +
-
+
+
{selected ? : null}
{!profile.errors?.length ? ( isLocalProfile(profile) ? ( { e.stopPropagation(); e.preventDefault(); @@ -103,9 +112,6 @@ const AssistantSelectOption = ({ /> ) : ( { e.stopPropagation(); @@ -215,7 +221,7 @@ export default function AssistantSelect() { return ( -
+
); })} diff --git a/gui/src/pages/config/UserSettingsForm.tsx b/gui/src/pages/config/UserSettingsForm.tsx index d9efc4c49..610ea913a 100644 --- a/gui/src/pages/config/UserSettingsForm.tsx +++ b/gui/src/pages/config/UserSettingsForm.tsx @@ -4,7 +4,7 @@ import { modifyAnyConfigWithSharedConfig, } from "core/config/sharedConfig"; import { useContext, useEffect, useState } from "react"; -import { Input } from "../../components"; +import { Input, SecondaryButton } from "../../components"; import NumberInput from "../../components/gui/NumberInput"; import { Select } from "../../components/gui/Select"; import ToggleSwitch from "../../components/gui/Switch"; @@ -101,55 +101,69 @@ export function UserSettingsForm() { }, [ideMessenger]); return ( -
+
+ {selectedProfile ? ( +
+ { + ideMessenger.post("config/openProfile", { + profileId: selectedProfile.id, + }); + }} + > + Open + Assistant + Config + +
+ ) : null} {!controlServerBetaEnabled || hubEnabled ? ( -
-
-
-
-

User settings

-
+
+
+

User settings

+
-
- - handleUpdate({ - showSessionTabs: !showSessionTabs, - }) - } - text="Show Session Tabs" - /> - - handleUpdate({ - codeWrap: !codeWrap, - }) - } - text="Wrap Codeblocks" - /> +
+ + handleUpdate({ + showSessionTabs: !showSessionTabs, + }) + } + text="Show Session Tabs" + /> + + handleUpdate({ + codeWrap: !codeWrap, + }) + } + text="Wrap Codeblocks" + /> - - handleUpdate({ - showChatScrollbar: !showChatScrollbar, - }) - } - text="Show Chat Scrollbar" - /> - - handleUpdate({ - readResponseTTS: !readResponseTTS, - }) - } - text="Text-to-Speech Output" - /> + + handleUpdate({ + showChatScrollbar: !showChatScrollbar, + }) + } + text="Show Chat Scrollbar" + /> + + handleUpdate({ + readResponseTTS: !readResponseTTS, + }) + } + text="Text-to-Speech Output" + /> - {/* handleUpdate({ @@ -158,46 +172,46 @@ export function UserSettingsForm() { } text="Use Chromium for Docs Crawling" /> */} - - handleUpdate({ - disableSessionTitles: !disableSessionTitles, - }) - } - text="Enable Session Titles" - /> - - handleUpdate({ - displayRawMarkdown: !displayRawMarkdown, - }) - } - text="Format Markdown" - /> + + handleUpdate({ + disableSessionTitles: !disableSessionTitles, + }) + } + text="Enable Session Titles" + /> + + handleUpdate({ + displayRawMarkdown: !displayRawMarkdown, + }) + } + text="Format Markdown" + /> - - handleUpdate({ - allowAnonymousTelemetry: !allowAnonymousTelemetry, - }) - } - text="Allow Anonymous Telemetry" - /> + + handleUpdate({ + allowAnonymousTelemetry: !allowAnonymousTelemetry, + }) + } + text="Allow Anonymous Telemetry" + /> - - handleUpdate({ - disableIndexing: !disableIndexing, - }) - } - text="Enable Indexing" - /> + + handleUpdate({ + disableIndexing: !disableIndexing, + }) + } + text="Enable Indexing" + /> - {/* handleUpdate({ @@ -207,89 +221,86 @@ export function UserSettingsForm() { text="Use Autocomplete Cache" /> */} -
) : null} From 1b32e625263177bbe553b747b235ce3c3f03c094 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Tue, 1 Apr 2025 16:37:45 -0700 Subject: [PATCH 2/5] fix listbox widths --- gui/src/components/ui/Listbox.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/src/components/ui/Listbox.tsx b/gui/src/components/ui/Listbox.tsx index 5bb235563..ed2e077bf 100644 --- a/gui/src/components/ui/Listbox.tsx +++ b/gui/src/components/ui/Listbox.tsx @@ -46,7 +46,7 @@ const ListboxOptions = React.forwardRef( anchor={"bottom start"} {...props} className={cn( - "bg-vsc-input-background flex flex-col overflow-auto px-0 shadow-md", + "bg-vsc-input-background flex w-max min-w-[160px] max-w-[400px] flex-col overflow-auto px-0 shadow-md", props.className, )} style={{ From 8ba246126a64abd5f04d6fd3166176fe8ae4de94 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Tue, 1 Apr 2025 16:41:19 -0700 Subject: [PATCH 3/5] cleanup --- .../components/modelSelection/platform/AssistantSelect.tsx | 6 ------ 1 file changed, 6 deletions(-) diff --git a/gui/src/components/modelSelection/platform/AssistantSelect.tsx b/gui/src/components/modelSelection/platform/AssistantSelect.tsx index b64b7306c..36495145d 100644 --- a/gui/src/components/modelSelection/platform/AssistantSelect.tsx +++ b/gui/src/components/modelSelection/platform/AssistantSelect.tsx @@ -34,12 +34,6 @@ import { ToolTip } from "../../gui/Tooltip"; import { useFontSize } from "../../ui/font"; import AssistantIcon from "./AssistantIcon"; -// interface OpenAssistantConfigProps { -// profile: ProfileDescription -// } -// const OpenAssistantConfigIcon = ({ profile }: Opean) => { - -// } interface AssistantSelectOptionProps { profile: ProfileDescription; selected: boolean; From 762daece953bb9981d5b424ee43d5ae91dd838d1 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Tue, 1 Apr 2025 16:51:51 -0700 Subject: [PATCH 4/5] scratch the open onfig file button --- gui/src/pages/config/UserSettingsForm.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gui/src/pages/config/UserSettingsForm.tsx b/gui/src/pages/config/UserSettingsForm.tsx index 610ea913a..d9a5cfd27 100644 --- a/gui/src/pages/config/UserSettingsForm.tsx +++ b/gui/src/pages/config/UserSettingsForm.tsx @@ -4,7 +4,7 @@ import { modifyAnyConfigWithSharedConfig, } from "core/config/sharedConfig"; import { useContext, useEffect, useState } from "react"; -import { Input, SecondaryButton } from "../../components"; +import { Input } from "../../components"; import NumberInput from "../../components/gui/NumberInput"; import { Select } from "../../components/gui/Select"; import ToggleSwitch from "../../components/gui/Switch"; @@ -102,7 +102,7 @@ export function UserSettingsForm() { return (
- {selectedProfile ? ( + {/* {selectedProfile && isLocalProfile(selectedProfile) ? (
Open - Assistant - Config + Config + File
- ) : null} + ) : null} */} {!controlServerBetaEnabled || hubEnabled ? (
From 65d43c272bbb6ef23dc3296e1b5718941c538f9e Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Tue, 1 Apr 2025 16:58:41 -0700 Subject: [PATCH 5/5] Update gui/src/components/mainInput/Lump/BlockSettingsTopToolbar.tsx --- gui/src/components/mainInput/Lump/BlockSettingsTopToolbar.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/src/components/mainInput/Lump/BlockSettingsTopToolbar.tsx b/gui/src/components/mainInput/Lump/BlockSettingsTopToolbar.tsx index dd4f2af94..ebef0251b 100644 --- a/gui/src/components/mainInput/Lump/BlockSettingsTopToolbar.tsx +++ b/gui/src/components/mainInput/Lump/BlockSettingsTopToolbar.tsx @@ -129,7 +129,7 @@ export function BlockSettingsTopToolbar(props: BlockSettingsTopToolbarProps) {
-
+