[BugFix] fix audio end bug (#5464)

This commit is contained in:
ming1753
2025-12-10 13:37:26 +08:00
committed by GitHub
parent 83a9ef51d7
commit 9e15191cce
2 changed files with 5 additions and 3 deletions

View File

@@ -115,7 +115,9 @@ class ChatResponseProcessor:
)
yield response
elif decode_type == 2: # audio
if self.eoa_token_id is not None and self.eoa_token_id in token_ids:
if self.eoa_token_id is not None and any(
token_id >= self.eoa_token_id for token_id in token_ids
):
continue
if req_id in self._audio_buffer:
self._audio_buffer[req_id].append(token_ids)

View File

@@ -60,9 +60,9 @@ class TestChatResponseProcessor(unittest.IsolatedAsyncioTestCase):
"""不开启 multimodal直接走 data_processor"""
processor = ChatResponseProcessor(self.mock_data_processor)
request_outputs = [
{"request_id": "req1", "outputs": {"decode_type": 2, "token_ids": [[11, 22]]}},
{"request_id": "req1", "outputs": {"decode_type": 2, "token_ids": [11, 22]}},
{"request_id": "req1", "outputs": {"decode_type": 0, "token_ids": [1]}},
{"request_id": "req1", "outputs": {"decode_type": 2, "token_ids": [[11, 22]]}},
{"request_id": "req1", "outputs": {"decode_type": 2, "token_ids": [11, 22]}},
{"request_id": "req1", "outputs": {"decode_type": 0, "token_ids": [2]}},
]