From 5fa8616c803665abb44c332f24a94c7a927f9538 Mon Sep 17 00:00:00 2001 From: tylerslaton Date: Fri, 28 Jun 2024 16:04:21 -0400 Subject: [PATCH] feat: add chat toggle for custom tools Signed-off-by: tylerslaton --- components/edit/configure/customTool.tsx | 29 +++++++++++++++++++++--- tool.gpt | 1 - 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/components/edit/configure/customTool.tsx b/components/edit/configure/customTool.tsx index 8eed4a97..ebef41e4 100644 --- a/components/edit/configure/customTool.tsx +++ b/components/edit/configure/customTool.tsx @@ -8,9 +8,12 @@ import { Avatar, Tooltip, Button, + Switch, } from "@nextui-org/react"; import { EditContext } from "@/contexts/edit"; import { GoTrash } from "react-icons/go"; +import { LuWrench, LuMessageSquare } from "react-icons/lu"; + interface ConfigureProps { file: string; @@ -21,11 +24,13 @@ interface ConfigureProps { const CustomTool: React.FC = ({file, className, tool }) => { const [customTool, setCustomTool] = useState({} as Tool); const [name, setName] = useState(''); - const { update, setRoot, setTools} = useContext(EditContext) + const [chat, setChat] = useState(false); + const { setRoot, setTools} = useContext(EditContext) useEffect(() => { setCustomTool(tool); setName(tool.name || '') }, []); useEffect(() => { + setChat(customTool.chat || false); setTools((prevTools) => { return prevTools.map((tool: Tool) => { if (tool.name === customTool.name) { @@ -102,7 +107,7 @@ const CustomTool: React.FC = ({file, className, tool }) => { return customTool &&
-
+
= ({file, className, tool }) => { + + setCustomTool({...customTool, chat: e.target.checked})} + thumbIcon={({ isSelected, className }) => + isSelected ? ( + + ) : ( + + ) + } + /> +