Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion local_mode/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ async def chat(request: ChatCompletionRequest):
else:
return JSONResponse(chat_with_codegeex(request))
except Exception as e:
return JSONResponse(e, status_code=500)
# JSONResponse expects a serializable content. Returning the exception
# object directly results in a "TypeError: Object of type ... is not JSON serializable".
# Convert the exception to a string so clients receive a meaningful
# error message instead of a server-side serialization failure.
return JSONResponse({"error": str(e)}, status_code=500)


if __name__ == "__main__":
Expand Down