Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
change
sglang
Commits
9c83d74d
Unverified
Commit
9c83d74d
authored
Aug 11, 2025
by
Chang Su
Committed by
GitHub
Aug 11, 2025
Browse files
bugfix: Fix the commentary msg extraction in GptOssDetector (#9097)
parent
b4ac2b9c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
python/sglang/srt/reasoning_parser.py
python/sglang/srt/reasoning_parser.py
+9
-9
No files found.
python/sglang/srt/reasoning_parser.py
View file @
9c83d74d
...
...
@@ -295,15 +295,15 @@ class GptOssDetector(BaseReasoningFormatDetector):
for
match
in
reversed
(
list
(
commentary_pattern
.
finditer
(
full_normal_text
))):
# Check if this commentary is a tool call by looking at the text before <|message|>
match_start
=
match
.
start
()
# Find
t
he
start of this
commentary s
ectio
n
commentary_start
=
full_normal_text
.
rfind
(
"<|channel|>commentary"
,
0
,
match_start
)
if
commentary_
start
!=
-
1
:
# Extract text between "commentary" and "<|message|>"
message_
pos
=
full_normal
_text
.
find
(
"<|message|>"
,
commentary_
start
)
if
message_
pos
!=
-
1
:
between_text
=
full_normal
_text
[
commentary_
start
:
message_
pos
]
# Find
w
he
re "<|channel|>
commentary
"
s
tarts within the matched patter
n
# The pattern starts with "<|start|>assistant<|channel|>commentary"
# So we look for the text between "commentary" and "<|message|>" in the match
match_text
=
full_normal_text
[
match_start
:
match
.
end
()]
commentary_
idx
=
match_text
.
find
(
"<|channel|>commentary"
)
if
commentary_idx
!=
-
1
:
message_
idx
=
match
_text
.
find
(
"<|message|>"
,
commentary_
idx
)
if
message_
idx
!=
-
1
:
between_text
=
match
_text
[
commentary_
idx
:
message_
idx
]
# If no "to=" found, this is regular commentary (reasoning content)
if
" to="
not
in
between_text
:
content
=
match
.
group
(
1
).
strip
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment