diff --git a/surfsense_web/components/assistant-ui/thread.tsx b/surfsense_web/components/assistant-ui/thread.tsx index d016efb24..b7a5bcf0e 100644 --- a/surfsense_web/components/assistant-ui/thread.tsx +++ b/surfsense_web/components/assistant-ui/thread.tsx @@ -19,10 +19,12 @@ import { ChevronRightIcon, CopyIcon, DownloadIcon, + Plus, RefreshCwIcon, + Settings2, SquareIcon, Unplug, - Wrench, + Upload, X, } from "lucide-react"; import { useParams } from "next/navigation"; @@ -53,6 +55,7 @@ import { currentUserAtom } from "@/atoms/user/user-query.atoms"; import { AssistantMessage } from "@/components/assistant-ui/assistant-message"; import { ChatSessionStatus } from "@/components/assistant-ui/chat-session-status"; import { ConnectorIndicator } from "@/components/assistant-ui/connector-popup"; +import { useDocumentUploadDialog } from "@/components/assistant-ui/document-upload-popup"; import { InlineMentionEditor, type InlineMentionEditorRef, @@ -73,6 +76,13 @@ import { import type { ThinkingStep } from "@/components/tool-ui/deepagent-thinking"; import { Avatar, AvatarFallback, AvatarGroup } from "@/components/ui/avatar"; import { Button } from "@/components/ui/button"; +import { Drawer, DrawerContent, DrawerHandle, DrawerTitle } from "@/components/ui/drawer"; +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuTrigger, +} from "@/components/ui/dropdown-menu"; import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"; import { Switch } from "@/components/ui/switch"; import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip"; @@ -278,21 +288,14 @@ const ConnectToolsBanner: FC = () => { ))} - { - if (e.key === "Enter" || e.key === " ") { - e.preventDefault(); - handleDismiss(e as unknown as React.MouseEvent); - } - }} className="shrink-0 ml-0.5 p-0.5 text-muted-foreground/40 hover:text-foreground transition-colors" aria-label="Dismiss" > - + ); @@ -564,6 +567,7 @@ const ComposerAction: FC = ({ isBlockedByOtherUser = false const setConnectorDialogOpen = useSetAtom(connectorDialogOpenAtom); const [toolsPopoverOpen, setToolsPopoverOpen] = useState(false); const isDesktop = useMediaQuery("(min-width: 640px)"); + const { openDialog: openUploadDialog } = useDocumentUploadDialog(); const [toolsScrollPos, setToolsScrollPos] = useState<"top" | "middle" | "bottom">("top"); const handleToolsScroll = useCallback((e: React.UIEvent) => { const el = e.currentTarget; @@ -607,87 +611,144 @@ const ComposerAction: FC = ({ isBlockedByOtherUser = false return (
- - - + + + + + + setToolsPopoverOpen(true)}> + + Manage Tools + + openUploadDialog()}> + + Upload Files + + + + + + +
+ Agent Tools + + {enabledCount}/{agentTools?.length ?? 0} enabled + +
+
+ {agentTools?.map((tool) => { + const isDisabled = disabledTools.includes(tool.name); + return ( +
+ + {formatToolName(tool.name)} + + toggleTool(tool.name)} + className="shrink-0" + /> +
+ ); + })} + {!agentTools?.length && ( +
+ Loading tools... +
+ )} +
+
+
+ + + ) : ( + + + + + + + e.preventDefault()} > - {agentTools?.map((tool) => { - const isDisabled = disabledTools.includes(tool.name); - const row = ( - - ); - if (!isDesktop) { - return
{row}
; - } - return ( - - {row} - - {tool.description} - - - ); - })} - {!agentTools?.length && ( -
- Loading tools... -
- )} -
- - - {!isDesktop && ( - setConnectorDialogOpen(true)} - > - - +
+ Agent Tools + + {enabledCount}/{agentTools?.length ?? 0} enabled + +
+
+ {agentTools?.map((tool) => { + const isDisabled = disabledTools.includes(tool.name); + const row = ( +
+ + {formatToolName(tool.name)} + + toggleTool(tool.name)} + className="shrink-0 scale-[0.6] sm:scale-75" + /> +
+ ); + return ( + + {row} + + {tool.description} + + + ); + })} + {!agentTools?.length && ( +
+ Loading tools... +
+ )} +
+ + )} {sidebarDocs.length > 0 && (