[bugfix][main]fix proxy decode bug (#3750)

### What this PR does / why we need it?

fix proxy decode bug when parsing non-UTF-8 characters.

- vLLM version: v0.11.0
- vLLM main:
c9461e05a4

---------

Signed-off-by: CHEN <116010019@link.cuhk.edu.cn>
This commit is contained in:
Shirley125
2025-10-27 16:56:09 +08:00
committed by GitHub
parent b8796b06c8
commit d8ca7fee75
2 changed files with 14 additions and 2 deletions

View File

@@ -556,7 +556,13 @@ async def _handle_completions(api: str, request: Request):
instance_info.prefiller_idx,
instance_info.prefiller_score)
released_kv = True
chunk_str = chunk.decode("utf-8").strip()
try:
chunk_str = chunk.decode("utf-8").strip()
except UnicodeDecodeError:
logger.debug(
f"Skipping chunk: {chunk}")
yield chunk
continue
if not chunk_str:
continue
if chunk_str.startswith("data: "):

View File

@@ -539,7 +539,13 @@ async def _handle_completions(api: str, request: Request):
instance_info.prefiller_idx,
instance_info.prefiller_score)
released_kv = True
chunk_str = chunk.decode("utf-8").strip()
try:
chunk_str = chunk.decode("utf-8").strip()
except UnicodeDecodeError:
logger.debug(
f"Skipping chunk: {chunk}")
yield chunk
continue
if not chunk_str:
continue
if chunk_str.startswith("data: "):