Refresh the character dropdown when saving/deleting a character
This commit is contained in:
parent
890b4abdad
commit
3e0a9f9cdb
2 changed files with 3 additions and 3 deletions
|
@ -508,7 +508,6 @@ def load_character(character, name1, name2, instruct=False):
|
||||||
context = shared.settings['context']
|
context = shared.settings['context']
|
||||||
name2 = shared.settings['name2']
|
name2 = shared.settings['name2']
|
||||||
greeting = shared.settings['greeting']
|
greeting = shared.settings['greeting']
|
||||||
turn_template = shared.settings['turn_template']
|
|
||||||
|
|
||||||
return name1, name2, picture, greeting, context, turn_template.replace("\n", r"\n")
|
return name1, name2, picture, greeting, context, turn_template.replace("\n", r"\n")
|
||||||
|
|
||||||
|
|
|
@ -54,12 +54,13 @@ def create_event_handlers():
|
||||||
|
|
||||||
shared.gradio['save_character_confirm'].click(
|
shared.gradio['save_character_confirm'].click(
|
||||||
chat.save_character, gradio('name2', 'greeting', 'context', 'character_picture', 'save_character_filename'), None).then(
|
chat.save_character, gradio('name2', 'greeting', 'context', 'character_picture', 'save_character_filename'), None).then(
|
||||||
lambda: gr.update(visible=False), None, gradio('character_saver'))
|
lambda: gr.update(visible=False), None, gradio('character_saver')).then(
|
||||||
|
lambda x: gr.update(choices=utils.get_available_characters(), value=x), gradio('save_character_filename'), gradio('character_menu'))
|
||||||
|
|
||||||
shared.gradio['delete_character_confirm'].click(
|
shared.gradio['delete_character_confirm'].click(
|
||||||
chat.delete_character, gradio('character_menu'), None).then(
|
chat.delete_character, gradio('character_menu'), None).then(
|
||||||
lambda: gr.update(visible=False), None, gradio('character_deleter')).then(
|
lambda: gr.update(visible=False), None, gradio('character_deleter')).then(
|
||||||
lambda: gr.update(choices=utils.get_available_characters()), None, gradio('character_menu'))
|
lambda: gr.update(choices=utils.get_available_characters(), value="None"), None, gradio('character_menu'))
|
||||||
|
|
||||||
shared.gradio['save_character_cancel'].click(lambda: gr.update(visible=False), None, gradio('character_saver'))
|
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'))
|
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