File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -181,6 +181,14 @@ function Main() {
181
181
document . getElementById ( 'message-input' ) ?. focus ( ) // better way?
182
182
} , [ messageInput ] )
183
183
184
+ const sessionListRef = useRef < HTMLDivElement > ( null )
185
+ const handleCreateNewSession = ( ) => {
186
+ store . createEmptyChatSession ( )
187
+ if ( sessionListRef . current ) {
188
+ sessionListRef . current . scrollTo ( 0 , 0 )
189
+ }
190
+ }
191
+
184
192
return (
185
193
< Box sx = { { height : '100vh' } } >
186
194
< Grid container spacing = { 2 } sx = { {
@@ -230,9 +238,12 @@ function Main() {
230
238
{ t ( 'chat' ) }
231
239
</ ListSubheader >
232
240
}
241
+ component = "div"
242
+ ref = { sessionListRef }
243
+ // dense
233
244
>
234
245
{
235
- store . chatSessions . map ( ( session , ix ) => (
246
+ [ ... store . chatSessions ] . reverse ( ) . map ( ( session , ix ) => (
236
247
< SessionItem key = { session . id }
237
248
selected = { store . currentSession . id === session . id }
238
249
session = { session }
@@ -254,7 +265,7 @@ function Main() {
254
265
255
266
< Divider />
256
267
257
- < MenuItem onClick = { ( ) => store . createEmptyChatSession ( ) } >
268
+ < MenuItem onClick = { handleCreateNewSession } >
258
269
< ListItemIcon >
259
270
< IconButton > < AddIcon fontSize = "small" /> </ IconButton >
260
271
</ ListItemIcon >
Original file line number Diff line number Diff line change @@ -197,9 +197,6 @@ function _Block(props: Props) {
197
197
/>
198
198
) : (
199
199
< Box
200
- sx = { {
201
- // bgcolor: "Background",
202
- } }
203
200
dangerouslySetInnerHTML = { { __html : md . render ( msg . content ) } }
204
201
/>
205
202
)
You can’t perform that action at this time.
0 commit comments