From 750502695c4339dc525d50cf428960d7ffbeeb05 Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Tue, 24 Mar 2026 11:39:24 -0700 Subject: [PATCH] Fix GPT-OSS tool-calling after 9ec20d97 --- modules/reasoning.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/modules/reasoning.py b/modules/reasoning.py index 9c92719b..aa1939b8 100644 --- a/modules/reasoning.py +++ b/modules/reasoning.py @@ -72,10 +72,9 @@ def extract_reasoning(text, html_escaped=False): if content_pos != -1: content_start = content_pos + len(content_esc) else: - # Content tag expected but not yet present (e.g. partial - # streaming) — suppress intermediate tags between end_tag - # and content_tag so they don't leak as content. - content_start = len(text) + # Content tag not present — fall back to content after + # end_tag (e.g. GPT-OSS tool calls skip the final channel). + content_start = end_pos + len(end_esc) else: content_start = end_pos + len(end_esc)