diff --git a/gui/src/components/mainInput/InputToolbar.tsx b/gui/src/components/mainInput/InputToolbar.tsx index 26c4cf4d8..dcc2ac0f7 100644 --- a/gui/src/components/mainInput/InputToolbar.tsx +++ b/gui/src/components/mainInput/InputToolbar.tsx @@ -1,6 +1,6 @@ import { AtSymbolIcon, PhotoIcon } from "@heroicons/react/24/outline"; import { InputModifiers } from "core"; -import { modelSupportsImages } from "core/llm/autodetect"; +import { modelSupportsImages, modelSupportsTools } from "core/llm/autodetect"; import { useRef } from "react"; import styled from "styled-components"; import { @@ -55,6 +55,7 @@ const EnterButton = styled.button` border-radius: ${defaultBorderRadius}; color: ${vscForeground}; cursor: pointer; + :disabled { cursor: wait; } @@ -82,16 +83,18 @@ interface InputToolbarProps { } function InputToolbar(props: InputToolbarProps) { - const dispatch = useAppDispatch(); const fileInputRef = useRef(null); const defaultModel = useAppSelector(selectDefaultModel); const useActiveFile = useAppSelector(selectUseActiveFile); const isInEditMode = useAppSelector(selectIsInEditMode); const hasCodeToEdit = useAppSelector(selectHasCodeToEdit); const { loadLastSession } = useHistory(dispatch); - const isEditModeAndNoCodeToEdit = isInEditMode && !hasCodeToEdit; const isEnterDisabled = props.disabled || isEditModeAndNoCodeToEdit; + const shouldRenderToolsButton = + defaultModel && + modelSupportsTools(defaultModel.model) && + !props.toolbarOptions?.hideTools; const supportsImages = defaultModel && @@ -112,7 +115,7 @@ function InputToolbar(props: InputToolbarProps) { >
-
+
{props.toolbarOptions?.hideImageUpload || (supportsImages && ( <> @@ -151,13 +154,15 @@ function InputToolbar(props: InputToolbarProps) { )} - {props.toolbarOptions?.hideTools || } + {shouldRenderToolsButton && }
{props.toolbarOptions?.hideUseCodebase || ( -
+