11import { useEffect , useMemo , useState } from 'react' ;
22import { CallbackGeneratedChunk , useAppContext } from '../utils/app.context' ;
33import ChatMessage from './ChatMessage' ;
4- import { CanvasType , Message , MessageExtraContext , PendingMessage } from '../utils/types' ;
4+ import { CanvasType , Message , PendingMessage } from '../utils/types' ;
55import { classNames , cleanCurrentUrl , throttle } from '../utils/misc' ;
66import CanvasPyInterpreter from './CanvasPyInterpreter' ;
77import StorageUtils from '../utils/storage' ;
@@ -12,12 +12,15 @@ import {
1212 StopIcon ,
1313 PaperClipIcon ,
1414 DocumentTextIcon ,
15+ XMarkIcon ,
1516} from '@heroicons/react/24/solid' ;
1617import {
1718 ChatExtraContextApi ,
1819 useChatExtraContext ,
1920} from './useChatExtraContext.tsx' ;
2021import Dropzone from 'react-dropzone' ;
22+ import toast from 'react-hot-toast' ;
23+ import ChatInputExtraContextItem from './ChatInputExtraContextItem.tsx' ;
2124
2225/**
2326 * A message display is a message node with additional information for rendering.
@@ -143,8 +146,10 @@ export default function ChatScreen() {
143146
144147 const sendNewMessage = async ( ) => {
145148 const lastInpMsg = textarea . value ( ) ;
146- if ( lastInpMsg . trim ( ) . length === 0 || isGenerating ( currConvId ?? '' ) )
149+ if ( lastInpMsg . trim ( ) . length === 0 || isGenerating ( currConvId ?? '' ) ) {
150+ toast . error ( 'Please enter a message' ) ;
147151 return ;
152+ }
148153 textarea . setValue ( '' ) ;
149154 scrollToBottom ( false ) ;
150155 setCurrNodeId ( - 1 ) ;
@@ -312,7 +317,16 @@ function ChatInput({
312317 multiple = { true }
313318 >
314319 { ( { getRootProps, getInputProps } ) => (
315- < div className = "flex rounded-xl border-1 border-base-content/30 p-3 w-full" { ...getRootProps ( ) } >
320+ < div
321+ className = "flex flex-col rounded-xl border-1 border-base-content/30 p-3 w-full"
322+ { ...getRootProps ( ) }
323+ >
324+ < ChatInputExtraContextItem
325+ items = { extraContext . items }
326+ removeItem = { extraContext . removeItem }
327+ />
328+
329+ < div className = "flex flex-row w-full" >
316330 < textarea
317331 // Default (mobile): Enable vertical resize, overflow auto for scrolling if needed
318332 // Large screens (lg:): Disable manual resize, apply max-height for autosize limit
@@ -367,15 +381,9 @@ function ChatInput({
367381 ) }
368382 </ div >
369383 </ div >
384+ </ div >
370385 ) }
371386 </ Dropzone >
372387 </ div >
373388 ) ;
374389}
375-
376- function ChatInputExtraContextItem ( { } : {
377- idx : number ,
378- item : MessageExtraContext ,
379- } ) {
380-
381- }
0 commit comments