Skip to content

Commit

Permalink
Merge pull request #377 from maxduke/patch-3
Browse files Browse the repository at this point in the history
fix "the JSON object must be str, bytes or bytearray, not dict"
  • Loading branch information
moeakwak authored Feb 7, 2024
2 parents 622fca5 + b0f669d commit 5cc42b8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion backend/api/sources/openai_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,10 @@ async def complete(self, model: OpenaiWebChatModels, text_content: str, use_team
if "[DONE]" in line:
break
try:
data = json.loads(line)
if not isinstance(line, dict):
data = json.loads(line)
else:
data = line
if not _check_fields(data):
if "error" in data:
logger.warning(f"error in message stream: {line}")
Expand Down

0 comments on commit 5cc42b8

Please sign in to comment.