@@ -31,7 +31,7 @@ import SpeechRecognition, {
3131import { useSpeechSynthesis } from "react-speech-kit" ;
3232import { toast } from "sonner" ;
3333import { useTheme } from "next-themes" ;
34- import { WrapText } from "lucide-react" ;
34+ import { Earth , EarthIcon , Globe , Paperclip , WrapText } from "lucide-react" ;
3535import { atomOneDark } from "react-syntax-highlighter/dist/esm/styles/hljs" ;
3636
3737const geistMono = Geist_Mono ( {
@@ -54,6 +54,8 @@ const UIInput = () => {
5454 "text" ,
5555 ) ;
5656 const [ query , setQuery ] = useState < string > ( "" ) ;
57+ const [ attachments , setAttachments ] = useState < File [ ] > ( [ ] ) ;
58+ const [ search , setSearch ] = useState < boolean > ( false ) ;
5759 const [ messages , setMessages ] = useState < Message [ ] > ( [ ] ) ;
5860 const [ showWelcome , setShowWelcome ] = useState ( true ) ;
5961 const [ copied , setCopied ] = useState ( false ) ;
@@ -376,6 +378,19 @@ const UIInput = () => {
376378 }
377379 } ;
378380
381+ const handleFileInput = ( ) => {
382+ const fileInput = document . createElement ( "input" ) ;
383+ fileInput . type = "file" ;
384+ fileInput . accept = "image/*" ;
385+ fileInput . onchange = ( e ) => {
386+ const file = ( e . target as HTMLInputElement ) . files ?. [ 0 ] ;
387+ if ( file ) {
388+ setAttachments ( ( prev ) => [ ...prev , file ] ) ;
389+ }
390+ } ;
391+ fileInput . click ( ) ;
392+ } ;
393+
379394 return (
380395 < div className = "flex h-[96vh] w-full overflow-hidden" >
381396 < div className = "relative flex h-full w-full flex-col" >
@@ -682,6 +697,16 @@ const UIInput = () => {
682697 onValueChange = { setModel }
683698 disabled = { isLoading }
684699 />
700+ { /* Search */ }
701+ < Button variant = "ghost" size = "sm" className = { `text-xs ${ search ? "bg-primary/60 hover:bg-primary/70" : "" } ` } onClick = { ( ) => setSearch ( ! search ) } >
702+ < Globe className = "size-4" />
703+ Search
704+ </ Button >
705+
706+ { /* Attachments */ }
707+ < Button variant = "ghost" size = "sm" className = "text-xs" onClick = { handleFileInput } >
708+ < Paperclip className = "size-4" />
709+ </ Button >
685710 </ div >
686711 < Button
687712 type = "submit"
0 commit comments