From cc22e1b01372a0d3d61a8edf4ae20dcdfc284150 Mon Sep 17 00:00:00 2001 From: sabaimran Date: Tue, 9 Jul 2024 19:46:17 +0530 Subject: [PATCH] Add pop-up module for the slash commands --- src/interface/web/app/chat/chat.module.css | 8 +- src/interface/web/app/chat/page.tsx | 212 +++++++++++++----- .../components/chatHistory/chatHistory.tsx | 2 +- .../referencePanel/referencePanel.tsx | 9 +- .../sidePanel/chatHistorySidePanel.tsx | 11 +- src/interface/web/app/factchecker/page.tsx | 28 ++- src/interface/web/components/ui/command.tsx | 2 +- 7 files changed, 193 insertions(+), 79 deletions(-) diff --git a/src/interface/web/app/chat/chat.module.css b/src/interface/web/app/chat/chat.module.css index 3d3c4665..98786272 100644 --- a/src/interface/web/app/chat/chat.module.css +++ b/src/interface/web/app/chat/chat.module.css @@ -11,8 +11,6 @@ div.main { } div.inputBox { - display: grid; - grid-template-columns: auto 1fr auto auto; border: 1px solid var(--border-color); border-radius: 16px; box-shadow: 0 4px 10px var(--box-shadow-color); @@ -20,6 +18,12 @@ div.inputBox { gap: 12px; padding-left: 20px; padding-right: 20px; + align-content: center; +} + +div.actualInputArea { + display: grid; + grid-template-columns: auto 1fr auto auto; } input.inputBox { diff --git a/src/interface/web/app/chat/page.tsx b/src/interface/web/app/chat/page.tsx index ca03eb32..98faad15 100644 --- a/src/interface/web/app/chat/page.tsx +++ b/src/interface/web/app/chat/page.tsx @@ -14,19 +14,48 @@ import { handleCompiledReferences, handleImageResponse, setupWebSocket, uploadDa import { Progress } from "@/components/ui/progress" import 'katex/dist/katex.min.css'; -import { Lightbulb, ArrowCircleUp, FileArrowUp, Microphone } from '@phosphor-icons/react'; +import { + ArrowCircleUp, + ArrowRight, + Browser, + ChatsTeardrop, + FileArrowUp, + GlobeSimple, + Gps, + Image, + Microphone, + Notebook, + Question, + Robot, + Shapes +} from '@phosphor-icons/react'; + +import { + Command, + CommandDialog, + CommandEmpty, + CommandGroup, + CommandInput, + CommandItem, + CommandList, + CommandSeparator, + CommandShortcut, +} from "@/components/ui/command" -import { Label } from "@/components/ui/label" import { Textarea } from "@/components/ui/textarea" import { Button } from '@/components/ui/button'; import { StreamMessage } from '../components/chatMessage/chatMessage'; import { AlertDialog, AlertDialogAction, AlertDialogContent, AlertDialogDescription, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger } from '@/components/ui/alert-dialog'; +import { Popover, PopoverContent } from '@/components/ui/popover'; +import { PopoverTrigger } from '@radix-ui/react-popover'; interface ChatInputProps { sendMessage: (message: string) => void; sendDisabled: boolean; setUploadedFiles?: (files: string[]) => void; conversationId?: string | null; + chatOptionsData?: ChatOptions | null; + isMobileWidth?: boolean; } function ChatInputArea(props: ChatInputProps) { @@ -68,6 +97,10 @@ function ChatInputArea(props: ChatInputProps) { setMessage(''); } + function handleSlashCommandClick(command: string) { + setMessage(`/${command} `); + } + function handleFileButtonClick() { if (!fileInputRef.current) return; fileInputRef.current.click(); @@ -85,6 +118,45 @@ function ChatInputArea(props: ChatInputProps) { props.conversationId); } + function getIconForSlashCommand(command: string) { + if (command.includes('summarize')) { + return + } + + if (command.includes('help')) { + return + } + + if (command.includes('automation')) { + return + } + + if (command.includes('webpage')) { + return + } + + if (command.includes('notes')) { + return + } + + if (command.includes('image')) { + return + } + + if (command.includes('default')) { + return + } + + if (command.includes('general')) { + return + } + + if (command.includes('online')) { + return + } + return + } + return ( <> { @@ -134,47 +206,84 @@ function ChatInputArea(props: ChatInputProps) { ) } - - -
-