From 66e991841a2e318cf88deeec4294f8df438ac80b Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Mon, 16 Jun 2025 18:45:44 -0700 Subject: [PATCH] Fix the character pfp not appearing when switching from instruct to chat modes --- modules/chat.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/chat.py b/modules/chat.py index 6b7722b7..d7683566 100644 --- a/modules/chat.py +++ b/modules/chat.py @@ -1849,6 +1849,11 @@ def handle_character_picture_change(picture): def handle_mode_change(state): history, loaded_unique_id = load_latest_history(state) histories = find_all_histories_with_first_prompts(state) + + # Ensure character picture cache exists + if state['mode'] in ['chat', 'chat-instruct'] and state['character_menu'] and state['character_menu'] != 'None': + generate_pfp_cache(state['character_menu']) + html = redraw_html(history, state['name1'], state['name2'], state['mode'], state['chat_style'], state['character_menu']) convert_to_markdown.cache_clear()