From 0ea62d88f60689b44dd4ee42ae9ba0ff871a29c2 Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Sat, 9 Aug 2025 21:47:02 -0700 Subject: [PATCH] mtmd: Fix "continue" when an image is present --- modules/chat.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/chat.py b/modules/chat.py index 696fa350..42bb58a5 100644 --- a/modules/chat.py +++ b/modules/chat.py @@ -868,6 +868,8 @@ def chatbot_wrapper(text, state, regenerate=False, _continue=False, loading_mess 'metadata': output['metadata'] } + row_idx = len(output['internal']) - 1 + # Collect image attachments for multimodal generation image_attachments = [] if 'metadata' in output: @@ -895,7 +897,6 @@ def chatbot_wrapper(text, state, regenerate=False, _continue=False, loading_mess prompt = generate_chat_prompt(text, state, **kwargs) # Add timestamp for assistant's response at the start of generation - row_idx = len(output['internal']) - 1 update_message_metadata(output['metadata'], "assistant", row_idx, timestamp=get_current_timestamp(), model_name=shared.model_name) # Generate