Skip to content

Commit

Permalink
fix content maybe a str (#2968)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouzaida authored Jan 26, 2024
1 parent 6d4ca23 commit eeabf52
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fastchat/serve/openai_api_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,9 @@ async def create_chat_completion(request: ChatCompletionRequest):
return create_error_response(ErrorCode.INTERNAL_ERROR, str(e))
usage = UsageInfo()
for i, content in enumerate(all_tasks):
if isinstance(content, str):
content = json.loads(content)

if content["error_code"] != 0:
return create_error_response(content["error_code"], content["text"])
choices.append(
Expand Down

0 comments on commit eeabf52

Please sign in to comment.