diff --git a/gui/src/components/mainInput/ContinueInputBox.tsx b/gui/src/components/mainInput/ContinueInputBox.tsx index bdfe15ba6..69264eb35 100644 --- a/gui/src/components/mainInput/ContinueInputBox.tsx +++ b/gui/src/components/mainInput/ContinueInputBox.tsx @@ -109,7 +109,6 @@ function ContinueInputBox(props: ContinueInputBoxProps) { hideImageUpload: false, hideUseCodebase: true, hideSelectModel: false, - hideTools: true, enterText: editModeState.editStatus === "accepting" ? "Retry" : "Edit", } : {}; diff --git a/gui/src/components/mainInput/InputToolbar.tsx b/gui/src/components/mainInput/InputToolbar.tsx index a6b92ab90..49c40e65d 100644 --- a/gui/src/components/mainInput/InputToolbar.tsx +++ b/gui/src/components/mainInput/InputToolbar.tsx @@ -67,7 +67,6 @@ export interface ToolbarOptions { hideAddContext?: boolean; enterText?: string; hideSelectModel?: boolean; - hideTools?: boolean; } interface InputToolbarProps { @@ -91,10 +90,7 @@ function InputToolbar(props: InputToolbarProps) { const hasCodeToEdit = useAppSelector(selectHasCodeToEdit); const isEditModeAndNoCodeToEdit = isInEditMode && !hasCodeToEdit; const isEnterDisabled = props.disabled || isEditModeAndNoCodeToEdit; - const toolsSupported = - defaultModel && - modelSupportsTools(defaultModel) && - !props.toolbarOptions?.hideTools; + const toolsSupported = defaultModel && modelSupportsTools(defaultModel); const supportsImages = defaultModel && diff --git a/gui/src/components/mainInput/InputToolbar/ToggleToolsButton.tsx b/gui/src/components/mainInput/InputToolbar/ToggleToolsButton.tsx index 3265b2778..cffc967f0 100644 --- a/gui/src/components/mainInput/InputToolbar/ToggleToolsButton.tsx +++ b/gui/src/components/mainInput/InputToolbar/ToggleToolsButton.tsx @@ -14,6 +14,7 @@ import InfoHover from "../../InfoHover"; import HoverItem from "./HoverItem"; import PopoverTransition from "./PopoverTransition"; import ToolDropdownItem from "./ToolDropdownItem"; +import { selectIsInEditMode } from "../../../redux/slices/sessionSlice"; interface ToolDropdownProps { disabled: boolean; @@ -28,6 +29,7 @@ export default function ToolDropdown(props: ToolDropdownProps) { const useTools = useAppSelector((state) => state.ui.useTools); const availableTools = useAppSelector((state) => state.config.config.tools); const [showAbove, setShowAbove] = useState(false); + const isInEditMode = useAppSelector(selectIsInEditMode); const ToolsIcon = useTools ? WrenchScrewdriverIconSolid @@ -48,33 +50,37 @@ export default function ToolDropdown(props: ToolDropdownProps) { } }, [isDropdownOpen]); + const isDisabled = props.disabled || isInEditMode; + return ( - !props.disabled && dispatch(toggleUseTools())}> + !isDisabled && dispatch(toggleUseTools())}>
!props.disabled && setIsHovered(true)} - onMouseLeave={() => !props.disabled && setIsHovered(false)} + onMouseEnter={() => !isDisabled && setIsHovered(true)} + onMouseLeave={() => !isDisabled && setIsHovered(false)} /> - {props.disabled && ( + {isDisabled && ( - This model does not support tool use + {isInEditMode + ? "Tool use not supported in edit mode" + : "This model does not support tool use"} )} - {!useTools && !props.disabled && ( + {!useTools && !isDisabled && ( Enable tool usage )} - {useTools && !props.disabled && ( + {useTools && !isDisabled && ( <> Tools @@ -84,7 +90,7 @@ export default function ToolDropdown(props: ToolDropdownProps) { onChange={() => {}} as="div" onClick={(e) => e.stopPropagation()} - disabled={props.disabled} + disabled={isDisabled} > {({ open }) => ( <> @@ -95,7 +101,7 @@ export default function ToolDropdown(props: ToolDropdownProps) { setDropdownOpen(!isDropdownOpen); }} className="text-lightgray flex cursor-pointer items-center border-none bg-transparent px-0 outline-none" - aria-disabled={props.disabled} + aria-disabled={isDisabled} > diff --git a/gui/src/redux/slices/sessionSlice.ts b/gui/src/redux/slices/sessionSlice.ts index dd8f0b5bb..c70de4035 100644 --- a/gui/src/redux/slices/sessionSlice.ts +++ b/gui/src/redux/slices/sessionSlice.ts @@ -53,7 +53,6 @@ type SessionState = { streamAborter: AbortController; codeToEdit: CodeToEdit[]; curCheckpointIndex: number; - currentMainEditorContent?: JSONContent; mainEditorContentTrigger?: JSONContent | undefined; symbols: FileSymbolMap; mode: MessageModes; diff --git a/gui/src/redux/store.ts b/gui/src/redux/store.ts index 8cfb8f937..f137cbe7b 100644 --- a/gui/src/redux/store.ts +++ b/gui/src/redux/store.ts @@ -33,9 +33,24 @@ const rootReducer = combineReducers({ const saveSubsetFilters = [ createFilter("session", [ "history", - "sessionId", "selectedOrganizationId", "selectedProfile", + "id", + "lastSessionId", + "title", + + // Persist edit mode in case closes in middle + "mode", + "codeToEdit", + + // TODO consider removing persisted profiles/orgs + "availableProfiles", + "organizations", + + // higher risk to persist + // codeBlockApplyStates + // symbols + // curCheckpointIndex ]), // Don't persist any of the edit state for now createFilter("editModeState", []), diff --git a/gui/src/redux/thunks/streamNormalInput.ts b/gui/src/redux/thunks/streamNormalInput.ts index 1bd82a030..fe20fa550 100644 --- a/gui/src/redux/thunks/streamNormalInput.ts +++ b/gui/src/redux/thunks/streamNormalInput.ts @@ -27,7 +27,10 @@ export const streamNormalInput = createAsyncThunk< throw new Error("Default model not defined"); } - const includeTools = useTools && modelSupportsTools(defaultModel); + const includeTools = + useTools && + modelSupportsTools(defaultModel) && + state.session.mode === "chat"; // Send request const gen = extra.ideMessenger.llmStreamChat(