1
1
import { useParams } from 'react-router-dom'
2
2
import useCourse from '../../hooks/useCourse'
3
3
import useUserStatus from '../../hooks/useUserStatus'
4
- import { useRef , useState , useContext } from 'react'
4
+ import { useState } from 'react'
5
5
import useLocalStorageState from '../../hooks/useLocalStorageState'
6
6
import { DEFAULT_MODEL } from '../../../config'
7
7
import useInfoTexts from '../../hooks/useInfoTexts'
@@ -10,17 +10,16 @@ import { FileSearchResult, ResponseStreamEventData } from '../../../shared/types
10
10
import useRetryTimeout from '../../hooks/useRetryTimeout'
11
11
import { useTranslation } from 'react-i18next'
12
12
import { handleCompletionStreamError } from './error'
13
- import { Box , Button , IconButton , Container } from '@mui/material'
13
+ import { Box , Button , IconButton } from '@mui/material'
14
14
import { Disclaimer } from './Disclaimer'
15
15
import { Conversation } from './Conversation'
16
16
import { ChatBox } from './ChatBox'
17
17
import { getCompletionStream } from './util'
18
18
import { SystemPrompt } from './System'
19
- import { AppContext } from '../../util/context'
20
19
import { Settings } from '@mui/icons-material'
21
20
import { SettingsModal } from './SettingsModal'
22
21
import { Link } from 'react-router-dom'
23
- import { useScrollToBottom } from './useScrollToBottom'
22
+ // import { useScrollToBottom } from './useScrollToBottom'
24
23
import { CitationsBox } from './CitationsBox'
25
24
import { useRagIndices } from '../../hooks/useRagIndices'
26
25
@@ -41,10 +40,6 @@ export const ChatV2 = () => {
41
40
id : string
42
41
} > ( 'general-prev-response' , { id : '' } )
43
42
44
- const appContainerRef = useContext ( AppContext )
45
- const chatContainerRef = useRef < HTMLDivElement > ( null )
46
- const inputFileRef = useRef < HTMLInputElement > ( null )
47
-
48
43
const [ settingsModalOpen , setSettingsModalOpen ] = useState ( false )
49
44
const [ activePromptId , setActivePromptId ] = useState ( '' )
50
45
const [ fileName , setFileName ] = useState < string > ( '' )
@@ -195,12 +190,17 @@ export const ChatV2 = () => {
195
190
clearRetryTimeout ( )
196
191
}
197
192
198
- useScrollToBottom ( chatContainerRef , appContainerRef , messages )
199
-
200
193
return (
201
- < Box sx = { { display : 'flex' , flexDirection : 'row' , p : 0 } } >
194
+ < Box
195
+ sx = { {
196
+ flex : 1 ,
197
+ display : 'flex' ,
198
+ flexDirection : 'row' ,
199
+ p : 0 ,
200
+ } }
201
+ >
202
202
{ /* Course chats columns */ }
203
- < Box sx = { { flex : 1 , borderRight : '1px solid lightgray' } } >
203
+ < Box sx = { { borderRight : '1px solid lightgray' } } >
204
204
< div > Course Chats</ div >
205
205
</ Box >
206
206
@@ -210,7 +210,6 @@ export const ChatV2 = () => {
210
210
position : 'relative' ,
211
211
display : 'flex' ,
212
212
flexDirection : 'column' ,
213
- p : '2rem' ,
214
213
} }
215
214
>
216
215
< SettingsModal
@@ -227,6 +226,7 @@ export const ChatV2 = () => {
227
226
display : 'flex' ,
228
227
justifyContent : 'space-between' ,
229
228
alignItems : 'center' ,
229
+ flexShrink : 0 ,
230
230
} }
231
231
>
232
232
< Box sx = { { display : 'flex' , gap : '1rem' } } >
@@ -239,7 +239,7 @@ export const ChatV2 = () => {
239
239
</ Box >
240
240
{ courseId ? < Link to = { '/v2' } > CurreChat</ Link > : < Link to = { '/v2/sandbox' } > Ohtu Sandbox</ Link > }
241
241
</ Box >
242
- < Box sx = { { display : 'flex' , width : '100%' } } >
242
+ < Box sx = { { flex : 1 , display : 'flex' , width : '100%' , overflow : 'hidden ' } } >
243
243
< Conversation messages = { messages } completion = { completion } fileSearchResult = { fileSearchResult } />
244
244
< ChatBox
245
245
disabled = { false }
@@ -251,15 +251,15 @@ export const ChatV2 = () => {
251
251
} }
252
252
/>
253
253
</ Box >
254
- { ragIndex && (
255
- < Box flex = { 1 } >
256
- < CitationsBox messages = { messages } fileSearchResult = { fileSearchResult } />
257
- </ Box >
258
- ) }
259
254
</ Box >
260
255
261
256
{ /* Annotations columns */ }
262
- < Box sx = { { flex : 1 } } > </ Box >
257
+ { /* <Box sx={{ flex: 1 }}></Box> */ }
258
+ { ragIndex && (
259
+ < Box flex = { 1 } >
260
+ < CitationsBox messages = { messages } fileSearchResult = { fileSearchResult } />
261
+ </ Box >
262
+ ) }
263
263
</ Box >
264
264
)
265
265
}
0 commit comments