Improve --multi-user mode

This commit is contained in:
oobabooga 2023-09-26 05:44:04 -07:00
parent 019371c0b6
commit 1ca54faaf0
10 changed files with 79 additions and 68 deletions

View file

@ -5,6 +5,7 @@ from modules.utils import gradio
def create_ui():
mu = shared.args.multi_user
# Text file saver
with gr.Box(visible=False, elem_classes='file-saver') as shared.gradio['file_saver']:
@ -12,7 +13,7 @@ def create_ui():
shared.gradio['save_root'] = gr.Textbox(lines=1, label='File folder', info='For reference. Unchangeable.', interactive=False)
shared.gradio['save_contents'] = gr.Textbox(lines=10, label='File contents')
with gr.Row():
shared.gradio['save_confirm'] = gr.Button('Save', elem_classes="small-button")
shared.gradio['save_confirm'] = gr.Button('Save', elem_classes="small-button", interactive=not mu)
shared.gradio['save_cancel'] = gr.Button('Cancel', elem_classes="small-button")
# Text file deleter
@ -20,20 +21,20 @@ def create_ui():
shared.gradio['delete_filename'] = gr.Textbox(lines=1, label='File name')
shared.gradio['delete_root'] = gr.Textbox(lines=1, label='File folder', info='For reference. Unchangeable.', interactive=False)
with gr.Row():
shared.gradio['delete_confirm'] = gr.Button('Delete', elem_classes="small-button", variant='stop')
shared.gradio['delete_confirm'] = gr.Button('Delete', elem_classes="small-button", variant='stop', interactive=not mu)
shared.gradio['delete_cancel'] = gr.Button('Cancel', elem_classes="small-button")
# Character saver/deleter
with gr.Box(visible=False, elem_classes='file-saver') as shared.gradio['character_saver']:
shared.gradio['save_character_filename'] = gr.Textbox(lines=1, label='File name', info='The character will be saved to your characters/ folder with this base filename.')
with gr.Row():
shared.gradio['save_character_confirm'] = gr.Button('Save', elem_classes="small-button")
shared.gradio['save_character_confirm'] = gr.Button('Save', elem_classes="small-button", interactive=not mu)
shared.gradio['save_character_cancel'] = gr.Button('Cancel', elem_classes="small-button")
with gr.Box(visible=False, elem_classes='file-saver') as shared.gradio['character_deleter']:
gr.Markdown('Confirm the character deletion?')
with gr.Row():
shared.gradio['delete_character_confirm'] = gr.Button('Delete', elem_classes="small-button", variant='stop')
shared.gradio['delete_character_confirm'] = gr.Button('Delete', elem_classes="small-button", variant='stop', interactive=not mu)
shared.gradio['delete_character_cancel'] = gr.Button('Cancel', elem_classes="small-button")