From 3e0a9f9cdb3b372c5f8bec314ec1a1a66aa0c43e Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Mon, 14 Aug 2023 08:18:21 -0700 Subject: [PATCH] Refresh the character dropdown when saving/deleting a character --- modules/chat.py | 1 - modules/ui_file_saving.py | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/chat.py b/modules/chat.py index dad3d8b..d83e949 100644 --- a/modules/chat.py +++ b/modules/chat.py @@ -508,7 +508,6 @@ def load_character(character, name1, name2, instruct=False): context = shared.settings['context'] name2 = shared.settings['name2'] greeting = shared.settings['greeting'] - turn_template = shared.settings['turn_template'] return name1, name2, picture, greeting, context, turn_template.replace("\n", r"\n") diff --git a/modules/ui_file_saving.py b/modules/ui_file_saving.py index 4ccc312..b467442 100644 --- a/modules/ui_file_saving.py +++ b/modules/ui_file_saving.py @@ -54,12 +54,13 @@ def create_event_handlers(): shared.gradio['save_character_confirm'].click( 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( chat.delete_character, gradio('character_menu'), None).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['delete_character_cancel'].click(lambda: gr.update(visible=False), None, gradio('character_deleter'))