mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-06 00:57:33 +08:00
[BugFix] fix max streaming tokens invalid (#3774)
* Update serving_chat.py * Update serving_completion.py
This commit is contained in:
@@ -298,11 +298,6 @@ class OpenAIServingChat:
|
|||||||
api_server_logger.info(f"Chat Streaming response last send: {chunk.model_dump_json()}")
|
api_server_logger.info(f"Chat Streaming response last send: {chunk.model_dump_json()}")
|
||||||
choices = []
|
choices = []
|
||||||
|
|
||||||
if choices:
|
|
||||||
chunk.choices = choices
|
|
||||||
yield f"data: {chunk.model_dump_json(exclude_unset=True)}\n\n"
|
|
||||||
choices = []
|
|
||||||
|
|
||||||
if include_usage:
|
if include_usage:
|
||||||
completion_tokens = previous_num_tokens
|
completion_tokens = previous_num_tokens
|
||||||
usage = UsageInfo(
|
usage = UsageInfo(
|
||||||
|
@@ -352,10 +352,6 @@ class OpenAIServingCompletion:
|
|||||||
)
|
)
|
||||||
yield f"data: {usage_chunk.model_dump_json(exclude_unset=True)}\n\n"
|
yield f"data: {usage_chunk.model_dump_json(exclude_unset=True)}\n\n"
|
||||||
api_server_logger.info(f"Completion Streaming response last send: {chunk.model_dump_json()}")
|
api_server_logger.info(f"Completion Streaming response last send: {chunk.model_dump_json()}")
|
||||||
if choices:
|
|
||||||
chunk.choices = choices
|
|
||||||
yield f"data: {chunk.model_dump_json(exclude_unset=True)}\n\n"
|
|
||||||
choices = []
|
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
yield f"data: {ErrorResponse(message=str(e), code=400).model_dump_json(exclude_unset=True)}\n\n"
|
yield f"data: {ErrorResponse(message=str(e), code=400).model_dump_json(exclude_unset=True)}\n\n"
|
||||||
|
Reference in New Issue
Block a user