Load the nearest character after deleting a character
Instead of the first.
This commit is contained in:
parent
ba87b9993d
commit
123f27a3c5
3 changed files with 15 additions and 5 deletions
|
@ -34,8 +34,8 @@ def create_ui():
|
|||
with gr.Group(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', interactive=not mu)
|
||||
shared.gradio['delete_character_cancel'] = gr.Button('Cancel', elem_classes="small-button")
|
||||
shared.gradio['delete_character_confirm'] = gr.Button('Delete', elem_classes="small-button", variant='stop', interactive=not mu)
|
||||
|
||||
# Preset saver
|
||||
with gr.Group(visible=False, elem_classes='file-saver') as shared.gradio['preset_saver']:
|
||||
|
@ -64,9 +64,10 @@ def create_event_handlers():
|
|||
lambda x: gr.update(choices=utils.get_available_characters(), value=x), gradio('save_character_filename'), gradio('character_menu'))
|
||||
|
||||
shared.gradio['delete_character_confirm'].click(
|
||||
lambda x: str(utils.get_available_characters().index(x)), gradio('character_menu'), gradio('temporary_text')).then(
|
||||
chat.delete_character, gradio('character_menu'), None).then(
|
||||
lambda: gr.update(visible=False), None, gradio('character_deleter')).then(
|
||||
lambda: gr.update(choices=(characters := utils.get_available_characters()), value=characters[0]), None, gradio('character_menu'))
|
||||
chat.update_character_menu_after_deletion, gradio('temporary_text'), gradio('character_menu')).then(
|
||||
lambda: gr.update(visible=False), None, gradio('character_deleter'))
|
||||
|
||||
shared.gradio['save_character_cancel'].click(lambda: gr.update(visible=False), None, gradio('character_saver'))
|
||||
shared.gradio['delete_character_cancel'].click(lambda: gr.update(visible=False), None, gradio('character_deleter'))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue