(null);
- const dispatch = useDispatch();
- const [isDropdownOpen, setDropdownOpen] = useState(false);
- const [isHovered, setIsHovered] = useState(false);
-
- 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
- : WrenchScrewdriverIconOutline;
-
- useEffect(() => {
- const checkPosition = () => {
- if (buttonRef.current) {
- const rect = buttonRef.current.getBoundingClientRect();
- const windowHeight = window.innerHeight;
- const spaceBelow = windowHeight - rect.bottom;
- setShowAbove(spaceBelow < 250);
- }
- };
-
- if (isDropdownOpen) {
- checkPosition();
- }
- }, [isDropdownOpen]);
-
- const isDisabled = props.disabled || isInEditMode;
-
- return (
- !isDisabled && dispatch(toggleUseTools())}>
-
-
!isDisabled && setIsHovered(true)}
- onMouseLeave={() => !isDisabled && setIsHovered(false)}
- />
- {isDisabled && (
-
- {isInEditMode
- ? "Tool use not supported in edit mode"
- : "This model does not support tool use"}
-
- )}
- {!useTools && !isDisabled && (
-
- Enable tool usage
-
- )}
-
- {useTools && !isDisabled && (
- <>
- Tools
-
-
-
{}}
- as="div"
- onClick={(e) => e.stopPropagation()}
- disabled={isDisabled}
- >
- {({ open }) => (
- <>
- {
- e.stopPropagation();
- setDropdownOpen(!isDropdownOpen);
- }}
- className="text-lightgray flex cursor-pointer items-center border-none bg-transparent px-0 outline-none"
- aria-disabled={isDisabled}
- >
-
-
- setDropdownOpen(false)}
- >
-
-
-
- Tool policies{" "}
-
-
-
- Automatic:
- {" "}
- Can be used without asking
-
-
-
- Allowed:
- {" "}
- Will ask before using
-
-
-
- Disabled:
- {" "}
- Cannot be used
-
-
- }
- />
-
-
-
- {availableTools.map((tool: any) => (
-
-
-
- ))}
-
-
-
- >
- )}
-
-
- >
- )}
-
-
- );
-}
diff --git a/gui/src/components/mainInput/InputToolbar/ToolDropdownItem.tsx b/gui/src/components/mainInput/InputToolbar/ToolDropdownItem.tsx
index 5df66f147..adea1943b 100644
--- a/gui/src/components/mainInput/InputToolbar/ToolDropdownItem.tsx
+++ b/gui/src/components/mainInput/InputToolbar/ToolDropdownItem.tsx
@@ -26,7 +26,7 @@ function ToolDropdownItem(props: ToolDropdownItemProps) {
return (
{
dispatch(toggleToolSetting(props.tool.function.name));
e.stopPropagation();
diff --git a/gui/src/components/mainInput/Lump/TopInputToolbar.tsx b/gui/src/components/mainInput/Lump/TopInputToolbar.tsx
index b6a6633fc..ab51c8bfa 100644
--- a/gui/src/components/mainInput/Lump/TopInputToolbar.tsx
+++ b/gui/src/components/mainInput/Lump/TopInputToolbar.tsx
@@ -4,6 +4,7 @@ import {
CubeIcon,
FolderIcon,
PencilIcon,
+ WrenchScrewdriverIcon,
} from "@heroicons/react/24/outline";
import AssistantSelect from "../../modelSelection/platform/AssistantSelect";
import HoverItem from "../InputToolbar/HoverItem";
@@ -90,6 +91,16 @@ export function TopInputToolbar(props: TopInputProps) {
)
}
/>
+
+ props.setSelectedSection(
+ props.selectedSection === "tools" ? null : "tools",
+ )
+ }
+ />
diff --git a/gui/src/components/mainInput/Lump/index.tsx b/gui/src/components/mainInput/Lump/index.tsx
index 3c50eef32..bd54b5015 100644
--- a/gui/src/components/mainInput/Lump/index.tsx
+++ b/gui/src/components/mainInput/Lump/index.tsx
@@ -39,7 +39,9 @@ export function Lump(props: LumpProps) {
setSelectedSection={setSelectedSection}
/>
-
+
+
+
);
diff --git a/gui/src/components/mainInput/Lump/sections/SelectedSection.tsx b/gui/src/components/mainInput/Lump/sections/SelectedSection.tsx
index 18e5f93c6..0e0da16d9 100644
--- a/gui/src/components/mainInput/Lump/sections/SelectedSection.tsx
+++ b/gui/src/components/mainInput/Lump/sections/SelectedSection.tsx
@@ -3,6 +3,7 @@ import { DocsSection } from "./DocsSection";
import { ModelsSection } from "./ModelsSection";
import { PromptsSection } from "./PromptsSection";
import { RulesSection } from "./RulesSection";
+import { ToolsSection } from "./ToolsSection";
interface SelectedSectionProps {
selectedSection: string | null;
@@ -20,6 +21,8 @@ export function SelectedSection(props: SelectedSectionProps) {
return ;
case "context":
return ;
+ case "tools":
+ return ;
default:
return null;
}
diff --git a/gui/src/components/mainInput/Lump/sections/ToolsSection.tsx b/gui/src/components/mainInput/Lump/sections/ToolsSection.tsx
new file mode 100644
index 000000000..34106b701
--- /dev/null
+++ b/gui/src/components/mainInput/Lump/sections/ToolsSection.tsx
@@ -0,0 +1,25 @@
+import { useAppSelector } from "../../../../redux/hooks";
+import { getFontSize } from "../../../../util";
+import ToolDropdownItem from "../../InputToolbar/ToolDropdownItem";
+
+interface ToolsSectionProps {}
+
+export function ToolsSection({}: ToolsSectionProps) {
+ const availableTools = useAppSelector((state) => state.config.config.tools);
+
+ return (
+
+ {availableTools.map((tool: any) => (
+
+
+
+ ))}
+
+ );
+}