mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-12-25 13:58:56 +01:00
UI: simplify the interface load events
This commit is contained in:
parent
5c5e7264ec
commit
5e7f4ee88a
19
server.py
19
server.py
@ -146,12 +146,21 @@ def create_interface():
|
||||
ui_model_menu.create_event_handlers()
|
||||
|
||||
# Interface launch events
|
||||
shared.gradio['interface'].load(None, None, None, js=f"() => {{if ({str(shared.settings['dark_theme']).lower()}) {{ document.getElementsByTagName('body')[0].classList.add('dark'); }} }}")
|
||||
shared.gradio['interface'].load(None, None, None, js=f"() => {{{js}}}")
|
||||
shared.gradio['interface'].load(None, gradio('show_controls'), None, js=f'(x) => {{{ui.show_controls_js}; toggle_controls(x)}}')
|
||||
shared.gradio['interface'].load(
|
||||
partial(ui.apply_interface_values, {}, use_persistent=True), None, gradio(ui.list_interface_input_elements()), show_progress=False).then(
|
||||
chat.redraw_html, gradio(ui_chat.reload_arr), gradio('display'), show_progress=False)
|
||||
None,
|
||||
gradio('show_controls'),
|
||||
None,
|
||||
js=f"""(x) => {{
|
||||
if ({str(shared.settings['dark_theme']).lower()}) {{
|
||||
document.getElementsByTagName('body')[0].classList.add('dark');
|
||||
}}
|
||||
{js}
|
||||
{ui.show_controls_js}
|
||||
toggle_controls(x);
|
||||
}}"""
|
||||
)
|
||||
|
||||
shared.gradio['interface'].load(partial(ui.apply_interface_values, {}, use_persistent=True), None, gradio(ui.list_interface_input_elements()), show_progress=False)
|
||||
|
||||
extensions_module.create_extensions_tabs() # Extensions tabs
|
||||
extensions_module.create_extensions_block() # Extensions block
|
||||
|
Loading…
Reference in New Issue
Block a user