@@ -4,32 +4,6 @@ import { Grid, CircularProgress, Typography, List, ListItem, Button } from '@mui
44import { KeyboardReturn } from '@mui/icons-material' ;
55
66const styles = {
7- list : {
8- display : 'flex' ,
9- alignItems : 'center' ,
10- justifyContent : 'space-between' ,
11- width : '60%' ,
12- border : '1px solid green' ,
13- borderRadius : '2rem' ,
14- margin : '0 auto 2rem'
15- } ,
16- listItem : {
17- width : '50%' ,
18- padding : '1rem' ,
19- textAlign : 'center' ,
20- listStyleType : 'none' ,
21- cursor : 'pointer' ,
22- transition : 'all 0.7s'
23- } ,
24- hoverListItem : {
25- width : '50%' ,
26- padding : '1rem' ,
27- textAlign : 'center' ,
28- listStyleType : 'none' ,
29- cursor : 'pointer' ,
30- transition : 'all 0.7s' ,
31- backgroundColor : '#39A2DB'
32- } ,
337 grid : {
348 alignItems : 'center' ,
359 display : 'flex' ,
@@ -44,25 +18,12 @@ const styles = {
4418 }
4519}
4620
47- const Tabs = ( { activeTab, setActiveTab } ) => {
48- return (
49- < List style = { styles . list } >
50- < ListItem onClick = { ( ) => setActiveTab ( 'chat' ) } style = { activeTab === 'chat' ? styles . hoverListItem : styles . listItem } >
51- Chat
52- </ ListItem >
53- < ListItem onClick = { ( ) => setActiveTab ( 'text' ) } style = { activeTab === 'text' ? styles . hoverListItem : styles . listItem } >
54- Text file
55- </ ListItem >
56- </ List >
57- ) ;
58- } ;
59-
6021const Chat = ( ) => {
6122 const [ userInput , setUserInput ] = useState ( '' ) ;
6223 const [ loading , setLoading ] = useState ( false ) ;
6324 const [ answer , setAnswer ] = useState ( '' ) ;
6425 const [ error , setError ] = useState ( '' ) ;
65- const [ activeTab , setActiveTab ] = useState ( 'text ' ) ;
26+ const [ activeTab , setActiveTab ] = useState ( 'chat ' ) ;
6627 const [ selectedFile , setSelectedFile ] = useState ( null ) ;
6728
6829 const handleInputChange = ( event ) => {
@@ -109,25 +70,26 @@ const Chat = () => {
10970
11071 return (
11172 < Grid container spacing = { 2 } style = { styles . grid } >
112- < Tabs activeTab = { activeTab } setActiveTab = { setActiveTab } > </ Tabs >
11373 < Grid item xs = { 8 } style = { { display : 'flex' , flexDirection : 'column' } } >
114- < input style = { styles . input }
74+ < div style = { { display : 'flex' } } >
75+ < input style = { styles . input }
11576 value = { userInput }
11677 onChange = { handleInputChange }
11778 onKeyDown = { handlSendUserInput }
11879 disabled = { loading }
11980 />
81+
82+ < KeyboardReturn style = { { marginLeft : '5px' , marginTop : '5px' } } />
83+ </ div >
12084
121- { activeTab === 'text' && < input accept = "image/*" id = "file-input" type = "file" onChange = { handleFileChange } /> }
122-
123- < Typography variant = "subtitle1" >
124- { ( selectedFile ) ? `Selected file: ${ selectedFile . name } ` : 'No file selected' }
125- </ Typography >
85+ < div style = { { marginTop : '2rem' , display : 'flex' , flexDirection : 'column' , alignItems : 'center' } } >
86+ < input accept = "image/*" id = "file-input" type = "file" onChange = { handleFileChange } />
12687 { selectedFile && (
12788 < Button >
12889 Upload
12990 </ Button >
13091 ) }
92+ </ div >
13193 </ Grid >
13294 < Grid item xs = { 8 } >
13395 < div >
0 commit comments