[bugfix][0.11]fix proxy decode bug (#3751)

### What this PR does / why we need it?
fix proxy decode bug while parsing non-UTF-8 characters.

---------

Signed-off-by: CHEN <116010019@link.cuhk.edu.cn>
This commit is contained in:
Shirley125
2025-10-27 16:56:50 +08:00
committed by GitHub
parent 43276fd822
commit e48ca0b6ec
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: "):