From f3388c2ab4cdf60cbd035d9a021b8e7de1e4665d Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Sun, 8 Jun 2025 18:53:04 -0700 Subject: [PATCH] Fix selecting next chat when deleting with active search --- modules/chat.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/chat.py b/modules/chat.py index ad5045e0..d62bbc42 100644 --- a/modules/chat.py +++ b/modules/chat.py @@ -1549,7 +1549,10 @@ def handle_start_new_chat_click(state): def handle_delete_chat_confirm_click(state): - index = str(find_all_histories(state).index(state['unique_id'])) + filtered_histories = find_all_histories_with_first_prompts(state) + filtered_ids = [h[1] for h in filtered_histories] + index = str(filtered_ids.index(state['unique_id'])) + delete_history(state['unique_id'], state['character_menu'], state['mode']) history, unique_id = load_history_after_deletion(state, index) html = redraw_html(history, state['name1'], state['name2'], state['mode'], state['chat_style'], state['character_menu'])