[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:
@@ -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: "):
|
||||
|
||||
@@ -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: "):
|
||||
|
||||
Reference in New Issue
Block a user