Fix a possible bug that occurs when attempting to encode a dictionary (dict) object as a string in a FastAPI application.
Browse files
main.py
CHANGED
|
@@ -165,13 +165,13 @@ model_handler = ModelRequestHandler()
|
|
| 165 |
|
| 166 |
@app.post("/v1/chat/completions")
|
| 167 |
async def request_model(request: RequestModel, token: str = Depends(verify_api_key)):
|
| 168 |
-
try:
|
| 169 |
-
|
| 170 |
-
except Exception as e:
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
|
| 176 |
@app.options("/v1/chat/completions")
|
| 177 |
async def options_handler():
|
|
|
|
| 165 |
|
| 166 |
@app.post("/v1/chat/completions")
|
| 167 |
async def request_model(request: RequestModel, token: str = Depends(verify_api_key)):
|
| 168 |
+
# try:
|
| 169 |
+
return await model_handler.request_model(request, token)
|
| 170 |
+
# except Exception as e:
|
| 171 |
+
# print('\033[31m')
|
| 172 |
+
# print(f"request_model Error: {str(e)}")
|
| 173 |
+
# traceback.print_exc()
|
| 174 |
+
# print('\033[0m')
|
| 175 |
|
| 176 |
@app.options("/v1/chat/completions")
|
| 177 |
async def options_handler():
|