@@ -66,7 +66,7 @@ export const ChatV2 = () => {
66
66
const appContainerRef = useContext ( AppContext )
67
67
const chatContainerRef = useRef < HTMLDivElement > ( null )
68
68
const conversationRef = useRef < HTMLElement > ( null )
69
- const settingsRef = useRef < HTMLElement > ( null )
69
+ const chatHeaderRef = useRef < HTMLElement > ( null )
70
70
const inputFieldRef = useRef < HTMLElement > ( null )
71
71
72
72
const [ setRetryTimeout , clearRetryTimeout ] = useRetryTimeout ( )
@@ -209,7 +209,7 @@ export const ChatV2 = () => {
209
209
210
210
useEffect ( ( ) => {
211
211
// Scrolls to bottom on initial load only
212
- if ( ! appContainerRef . current || ! conversationRef . current || ! settingsRef . current || messages . length === 0 ) return
212
+ if ( ! appContainerRef . current || ! conversationRef . current || ! chatHeaderRef . current || messages . length === 0 ) return
213
213
if ( isCompletionDone ) {
214
214
const container = appContainerRef . current
215
215
if ( container ) {
@@ -223,13 +223,13 @@ export const ChatV2 = () => {
223
223
224
224
useEffect ( ( ) => {
225
225
// Scrolls to last assistant message on text generation
226
- if ( ! appContainerRef . current || ! conversationRef . current || ! settingsRef . current || messages . length === 0 ) return
226
+ if ( ! appContainerRef . current || ! conversationRef . current || ! chatHeaderRef . current || messages . length === 0 ) return
227
227
228
228
const lastNode = conversationRef . current . lastElementChild as HTMLElement
229
229
230
230
if ( lastNode . classList . contains ( 'message-role-assistant' ) && ! isCompletionDone ) {
231
231
const container = appContainerRef . current
232
- const settingsHeight = settingsRef . current . clientHeight
232
+ const settingsHeight = chatHeaderRef . current . clientHeight
233
233
234
234
const containerRect = container . getBoundingClientRect ( )
235
235
const lastNodeRect = lastNode . getBoundingClientRect ( )
@@ -259,12 +259,22 @@ export const ChatV2 = () => {
259
259
< Typography variant = "h6" fontWeight = "light" >
260
260
Currechat
261
261
</ Typography >
262
- < CourseOption link = "/v2" > Basic</ CourseOption >
263
262
264
- < Typography variant = "h6" fontWeight = "light" sx = { { mt : '2rem' } } >
263
+ < Box sx = { { display : 'flex' , flexDirection : 'column' , gap : '0.2rem' , padding : '0.5rem' } } >
264
+ < CourseOption link = "/v2" isActive = { ! course } >
265
+ Tavallinen
266
+ </ CourseOption >
267
+ </ Box >
268
+
269
+ < Typography variant = "h6" fontWeight = "light" mt = { '2rem' } mb = "0.2rem" >
265
270
Kurssichatit
266
271
</ Typography >
267
- < CourseOption link = "/v2/sandbox" > Ohtu sandbox</ CourseOption >
272
+
273
+ < Box sx = { { display : 'flex' , flexDirection : 'column' , gap : '0.2rem' , padding : '0.5rem' } } >
274
+ < CourseOption link = "/v2/sandbox" isActive = { ! ! course } >
275
+ OHTE sandbox
276
+ </ CourseOption >
277
+ </ Box >
268
278
</ Box >
269
279
</ Box >
270
280
@@ -280,30 +290,36 @@ export const ChatV2 = () => {
280
290
} }
281
291
>
282
292
< Box
283
- ref = { settingsRef }
293
+ ref = { chatHeaderRef }
284
294
sx = { {
285
295
position : 'sticky' ,
286
296
top : 80 ,
287
297
display : 'flex' ,
288
- justifyContent : 'center' ,
289
- alignItems : 'center' ,
290
- gap : '1.2rem' ,
298
+ flexDirection : 'column' ,
291
299
backgroundColor : 'white' ,
292
300
padding : '1.8rem 1rem 0.8rem 1rem' ,
293
301
zIndex : 10 ,
294
302
} }
295
303
>
296
- { /* {disclaimerInfo && <Disclaimer disclaimer={disclaimerInfo} /> }
304
+ { course && (
305
+ < Typography variant = "h4" sx = { { textAlign : 'center' , fontWeight : 'bold' , mb : '1.5rem' } } >
306
+ { course . id }
307
+ </ Typography >
308
+ ) }
309
+
310
+ < Box sx = { { display : 'flex' , alignItems : 'center' , justifyContent : 'center' , gap : '1.5rem' } } >
311
+ { /* {disclaimerInfo && <Disclaimer disclaimer={disclaimerInfo} /> }
297
312
{/* <SettingsButton startIcon={<AddCommentIcon />}>Alustus</SettingsButton> */ }
298
- < SettingsButton startIcon = { < SettingsIcon /> } onClick = { ( ) => setSettingsModalOpen ( true ) } >
299
- Keskustelun asetukset
300
- </ SettingsButton >
301
- < SettingsButton startIcon = { < EmailIcon /> } onClick = { ( ) => alert ( 'Ei toimi vielä' ) } >
302
- Tallenna sähköpostina
303
- </ SettingsButton >
304
- < SettingsButton startIcon = { < DeleteIcon /> } onClick = { handleReset } >
305
- Tyhjennä
306
- </ SettingsButton >
313
+ < SettingsButton startIcon = { < SettingsIcon /> } onClick = { ( ) => setSettingsModalOpen ( true ) } >
314
+ Keskustelun asetukset
315
+ </ SettingsButton >
316
+ < SettingsButton startIcon = { < EmailIcon /> } onClick = { ( ) => alert ( 'Ei toimi vielä' ) } >
317
+ Tallenna sähköpostina
318
+ </ SettingsButton >
319
+ < SettingsButton startIcon = { < DeleteIcon /> } onClick = { handleReset } >
320
+ Tyhjennä
321
+ </ SettingsButton >
322
+ </ Box >
307
323
</ Box >
308
324
309
325
< Box
@@ -319,7 +335,7 @@ export const ChatV2 = () => {
319
335
>
320
336
< Conversation
321
337
conversationRef = { conversationRef }
322
- expandedNodeHeight = { window . innerHeight - settingsRef . current ?. clientHeight - inputFieldRef . current ?. clientHeight }
338
+ expandedNodeHeight = { window . innerHeight - chatHeaderRef . current ?. clientHeight - inputFieldRef . current ?. clientHeight }
323
339
messages = { messages }
324
340
completion = { completion }
325
341
isCompletionDone = { isCompletionDone }
0 commit comments