From cf1aad2a687622358e121497c30508e960267662 Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Sat, 30 Aug 2025 12:16:45 -0700 Subject: [PATCH] Fix "continue" for Byte-OSS for partial thinking blocks --- modules/chat.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/modules/chat.py b/modules/chat.py index 3c61a0dd..6d85bc6e 100644 --- a/modules/chat.py +++ b/modules/chat.py @@ -333,7 +333,23 @@ def generate_chat_prompt(user_input, state, **kwargs): if _continue: prompt = prompt.split("fake assistant message replace me", 1)[0] - prompt += last_message.get("content", "") + content = last_message.get("content", "") + thinking = last_message.get("thinking", "") + reasoning = last_message.get("reasoning_content", "") + + partial_thought = thinking or reasoning + # Handle partial thinking blocks (GPT-OSS and Seed-OSS) + if partial_thought and partial_thought.strip(): + search_string = partial_thought.strip() + index = prompt.rfind(search_string) + if index != -1: + prompt = prompt[:index] + partial_thought + else: + # Fallback + prompt += content + else: + # All other cases + prompt += content if impersonate: prompt = prompt.split("fake user message replace me", 1)[0]