@@ -271,76 +271,72 @@ def on_building_ui(self):
271271 self .hint_page = HintPage (self ._app )
272272
273273 with gr .Column (scale = 6 , elem_id = "chat-area" ):
274+ self .chat_panel = ChatPanel (self ._app )
275+
274276 if KH_DEMO_MODE :
275277 self .paper_list = PaperListPage (self ._app )
276278
277- self .chat_panel = ChatPanel (self ._app )
278-
279- with gr .Row ():
280- with gr .Accordion (
281- label = "Chat settings" ,
282- elem_id = "chat-settings-expand" ,
283- open = False ,
284- ):
285- with gr .Row (elem_id = "quick-setting-labels" ):
286- gr .HTML ("Reasoning method" )
287- gr .HTML ("Model" , visible = not KH_DEMO_MODE )
288- gr .HTML ("Language" )
289-
290- with gr .Row ():
291- reasoning_setting = (
292- self ._app .default_settings .reasoning .settings ["use" ]
293- )
294- model_setting = (
295- self ._app .default_settings .reasoning .options [
296- "simple"
297- ].settings ["llm" ]
298- )
299- language_setting = (
300- self ._app .default_settings .reasoning .settings ["lang" ]
301- )
302- citation_setting = (
303- self ._app .default_settings .reasoning .options [
304- "simple"
305- ].settings ["highlight_citation" ]
306- )
279+ with gr .Accordion (
280+ label = "Chat settings" ,
281+ elem_id = "chat-settings-expand" ,
282+ open = False ,
283+ visible = not KH_DEMO_MODE ,
284+ ) as self .chat_settings :
285+ with gr .Row (elem_id = "quick-setting-labels" ):
286+ gr .HTML ("Reasoning method" )
287+ gr .HTML ("Model" , visible = not KH_DEMO_MODE )
288+ gr .HTML ("Language" )
289+
290+ with gr .Row ():
291+ reasoning_setting = (
292+ self ._app .default_settings .reasoning .settings ["use" ]
293+ )
294+ model_setting = self ._app .default_settings .reasoning .options [
295+ "simple"
296+ ].settings ["llm" ]
297+ language_setting = (
298+ self ._app .default_settings .reasoning .settings ["lang" ]
299+ )
300+ citation_setting = self ._app .default_settings .reasoning .options [
301+ "simple"
302+ ].settings ["highlight_citation" ]
307303
308- self .reasoning_type = gr .Dropdown (
309- choices = reasoning_setting .choices [:REASONING_LIMITS ],
310- value = reasoning_setting .value ,
311- container = False ,
312- show_label = False ,
313- )
314- self .model_type = gr .Dropdown (
315- choices = model_setting .choices ,
316- value = model_setting .value ,
317- container = False ,
318- show_label = False ,
319- visible = not KH_DEMO_MODE ,
320- )
321- self .language = gr .Dropdown (
322- choices = language_setting .choices ,
323- value = language_setting .value ,
324- container = False ,
325- show_label = False ,
326- )
304+ self .reasoning_type = gr .Dropdown (
305+ choices = reasoning_setting .choices [:REASONING_LIMITS ],
306+ value = reasoning_setting .value ,
307+ container = False ,
308+ show_label = False ,
309+ )
310+ self .model_type = gr .Dropdown (
311+ choices = model_setting .choices ,
312+ value = model_setting .value ,
313+ container = False ,
314+ show_label = False ,
315+ visible = not KH_DEMO_MODE ,
316+ )
317+ self .language = gr .Dropdown (
318+ choices = language_setting .choices ,
319+ value = language_setting .value ,
320+ container = False ,
321+ show_label = False ,
322+ )
327323
328- self .citation = gr .Dropdown (
329- choices = citation_setting .choices ,
330- value = citation_setting .value ,
331- container = False ,
332- show_label = False ,
333- interactive = True ,
334- elem_id = "citation-dropdown" ,
335- )
324+ self .citation = gr .Dropdown (
325+ choices = citation_setting .choices ,
326+ value = citation_setting .value ,
327+ container = False ,
328+ show_label = False ,
329+ interactive = True ,
330+ elem_id = "citation-dropdown" ,
331+ )
336332
337- self .use_mindmap = gr .State (value = True )
338- self .use_mindmap_check = gr .Checkbox (
339- label = "Mindmap (on)" ,
340- container = False ,
341- elem_id = "use-mindmap-checkbox" ,
342- value = True ,
343- )
333+ self .use_mindmap = gr .State (value = True )
334+ self .use_mindmap_check = gr .Checkbox (
335+ label = "Mindmap (on)" ,
336+ container = False ,
337+ elem_id = "use-mindmap-checkbox" ,
338+ value = True ,
339+ )
344340
345341 with gr .Column (
346342 scale = INFO_PANEL_SCALES [False ], elem_id = "chat-info-panel"
@@ -523,8 +519,8 @@ def on_register_events(self):
523519 ]
524520 + self ._indices_input ,
525521 ).then (
526- lambda : gr .update (visible = False ),
527- outputs = [self .paper_list .accordion ],
522+ lambda : ( gr .update (visible = False ), gr . update ( visible = True ) ),
523+ outputs = [self .paper_list .accordion , self . chat_settings ],
528524 ).then (
529525 fn = None ,
530526 inputs = None ,
@@ -678,8 +674,8 @@ def on_register_events(self):
678674
679675 if KH_DEMO_MODE :
680676 onConvSelect = onConvSelect .then (
681- lambda : gr .update (visible = False ),
682- outputs = [self .paper_list .accordion ],
677+ lambda : ( gr .update (visible = False ), gr . update ( visible = True ) ),
678+ outputs = [self .paper_list .accordion , self . chat_settings ],
683679 )
684680
685681 onConvSelect = (
@@ -804,8 +800,8 @@ def raise_error_on_state(state):
804800 outputs = [self .quick_urls ],
805801 show_progress = "hidden" ,
806802 ).then (
807- lambda : gr .update (visible = False ),
808- outputs = [self .paper_list .accordion ],
803+ lambda : ( gr .update (visible = False ), gr . update ( visible = True ) ),
804+ outputs = [self .paper_list .accordion , self . chat_settings ],
809805 ).then (
810806 fn = None ,
811807 inputs = None ,
0 commit comments