randydev commited on
Commit
f0a24e7
·
verified ·
1 Parent(s): 2256f29

Upload main.py

Browse files
Files changed (1) hide show
  1. main.py +7 -3
main.py CHANGED
@@ -476,9 +476,13 @@ def no_chatgpt(query: str=None):
476
  url = "http://216.98.10.228:5000"
477
  api_method = f"{url}/gpt?ask={query}"
478
  response = requests.get(api_method)
 
 
479
  return SuccessResponse(status="True", randydev={"message": response.text})
480
- except:
481
- return SuccessResponse(status="False", randydev={"message": "Error response"})
 
 
482
 
483
  @app.get("/ryuzaki/freechatgpt-beta", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
484
  def free_chatgpt4_beta(item: ChatgptCustom):
@@ -1357,7 +1361,7 @@ def custom_openapi():
1357
  return app.openapi_schema
1358
  openapi_schema = get_openapi(
1359
  title="RyuzakiLib API",
1360
- version="2.3.0",
1361
  summary="Use It Only For Personal Project Else I Need To Delete The Api",
1362
  description=description,
1363
  routes=app.routes,
 
476
  url = "http://216.98.10.228:5000"
477
  api_method = f"{url}/gpt?ask={query}"
478
  response = requests.get(api_method)
479
+ if response.status_code != 200:
480
+ return SuccessResponse(status="False", randydev={"message": f"Error response"})
481
  return SuccessResponse(status="True", randydev={"message": response.text})
482
+ except requests.exceptions.ConnectTimeout as e:
483
+ return SuccessResponse(status="False", randydev={"message": f"Error response: {e}"})
484
+ except Exception as e:
485
+ return SuccessResponse(status="False", randydev={"message": f"Error response: {e}"})
486
 
487
  @app.get("/ryuzaki/freechatgpt-beta", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
488
  def free_chatgpt4_beta(item: ChatgptCustom):
 
1361
  return app.openapi_schema
1362
  openapi_schema = get_openapi(
1363
  title="RyuzakiLib API",
1364
+ version="2.3.1",
1365
  summary="Use It Only For Personal Project Else I Need To Delete The Api",
1366
  description=description,
1367
  routes=app.routes,