[Bugfix][Frontend][gpt-oss] Recover raw tail when Harmony parser ends non-terminal (#47379)
This commit is contained in:
@@ -18,7 +18,7 @@ from openai.types.responses.response_output_item import McpCall
|
||||
from openai.types.responses.response_output_message import ResponseOutputMessage
|
||||
from openai.types.responses.response_output_text import ResponseOutputText
|
||||
from openai.types.responses.tool import Mcp
|
||||
from openai_harmony import Author, HarmonyError, Message, Role, TextContent
|
||||
from openai_harmony import Author, Message, Role, TextContent
|
||||
|
||||
from vllm import envs
|
||||
from vllm.entrypoints.chat_utils import (
|
||||
@@ -616,7 +616,7 @@ class HarmonyContext(ConversationContext):
|
||||
self.num_tool_output_tokens = 0
|
||||
|
||||
self.last_append_segments: list[Segment] = []
|
||||
self.last_append_flush_status: bool | HarmonyError = False
|
||||
self.last_append_flush_status: bool = False
|
||||
|
||||
# Turn tracking - replaces multiple individual tracking variables
|
||||
self.current_turn_metrics = TurnMetrics()
|
||||
@@ -643,10 +643,10 @@ class HarmonyContext(ConversationContext):
|
||||
|
||||
if output.finished:
|
||||
self.finish_reason = output.outputs[0].finish_reason
|
||||
flushed = self.response_parser.flush()
|
||||
if flushed is not None:
|
||||
segments.append(flushed)
|
||||
self.last_append_flush_status = flushed is not None
|
||||
flushed_segments = self.response_parser.flush()
|
||||
if flushed_segments:
|
||||
segments.extend(flushed_segments)
|
||||
self.last_append_flush_status = len(flushed_segments) > 0
|
||||
self.all_turn_metrics.append(self.current_turn_metrics.copy())
|
||||
self.current_turn_metrics.reset()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user