From 0dd4e7a77d1cce3f5b934af42efa9bebacb622c6 Mon Sep 17 00:00:00 2001 From: svsairevanth12 Date: Wed, 4 Jun 2025 15:49:53 +0530 Subject: [PATCH] Update ToolUseSwitch component and Chat tests --- .../src/components/ChatForm/ToolUseSwitch.tsx | 102 ++++++++++-------- .../gui/src/features/Chat/Chat.test.tsx | 16 ++- 2 files changed, 70 insertions(+), 48 deletions(-) diff --git a/refact-agent/gui/src/components/ChatForm/ToolUseSwitch.tsx b/refact-agent/gui/src/components/ChatForm/ToolUseSwitch.tsx index 9b0a7de60..2f23521b5 100644 --- a/refact-agent/gui/src/components/ChatForm/ToolUseSwitch.tsx +++ b/refact-agent/gui/src/components/ChatForm/ToolUseSwitch.tsx @@ -1,7 +1,7 @@ -import React from "react"; -import { Flex, SegmentedControl, Text, HoverCard } from "@radix-ui/themes"; +import React, { useMemo } from "react"; +import { Flex, Text } from "@radix-ui/themes"; import { ToolUse } from "../../features/Chat/Thread"; -import { QuestionMarkCircledIcon } from "@radix-ui/react-icons"; +import { Select, type ItemProps } from "../Select"; type ToolUseSwitchProps = { toolUse: ToolUse; @@ -12,50 +12,64 @@ export const ToolUseSwitch = React.forwardRef< HTMLDivElement, ToolUseSwitchProps >(({ toolUse, setToolUse }, ref) => { + const options: ItemProps[] = useMemo(() => [ + { + value: "quick", + children: "Quick", + tooltip: ( +
+ Quick + + The model doesn't have access to any tools and answers + immediately. You still can provide context using @-commands, try + @help. + +
+ ), + }, + { + value: "explore", + children: "Explore", + tooltip: ( +
+ Explore + + The model has access to exploration tools and collects the + necessary context for you. + +
+ ), + }, + { + value: "agent", + children: "Agent", + tooltip: ( +
+ Agent + + The model has agent capabilities, might take a long time to + respond. For example it can provide a high-quality context to + solve a problem. + +
+ ), + }, + ], []); + + const handleChange = (value: string) => { + setToolUse(value as ToolUse); + }; + return ( How fast do you want the answer: - - { - setToolUse(x as ToolUse); - }} - > - Quick - Explore - Agent - - - - - - - Quick - - The model doesn't have access to any tools and answers - immediately. You still can provide context using @-commands, try - @help. - - - Explore - - - The model has access to exploration tools and collects the - necessary context for you. - - - Agent - - - The model has agent capabilities, might take a long time to - respond. For example it can provide a high-quality context to - solve a problem. - - - - +