randydev commited on
Commit
c97e3fc
1 Parent(s): 3707524

Upload main.py

Browse files
Files changed (1) hide show
  1. main.py +23 -10
main.py CHANGED
@@ -490,21 +490,34 @@ def chatgpt4_support(
490
  return {"status": "false", "message": "Error response."}
491
 
492
  @app.post("/ryuzaki/chatgpt-model")
493
- def chatgpt_model(
494
- query: str=None,
495
- model_id: int=1,
496
- is_models: bool=True
497
- ):
498
- try:
499
- response = RendyDevChat(query).get_response_model(model_id=model_id, is_models=is_models)
 
 
500
  return {
501
  "status": "true",
502
  "randydev":{
503
- "message": response
 
 
 
 
 
 
 
 
 
 
 
 
 
504
  }
505
  }
506
- except:
507
- return {"status": "false", "message": "Error response."}
508
 
509
  @app.get("/ryuzaki/freechatgpt-beta")
510
  def free_chatgpt4_beta(query: str):
 
490
  return {"status": "false", "message": "Error response."}
491
 
492
  @app.post("/ryuzaki/chatgpt-model")
493
+ def chatgpt_model(query: str=None, model_id: int=None, is_models: bool=False):
494
+ url = "https://lexica.qewertyy.me/models"
495
+ if is_models:
496
+ params = {"model_id": model_id, "prompt": query}
497
+ response = requests.post(url, params=params)
498
+ if response.status_code != 200:
499
+ return f"Error status: {response.status_code}"
500
+ check_response = response.json()
501
+ answer = check_response.get("content")
502
  return {
503
  "status": "true",
504
  "randydev":{
505
+ "message": answer
506
+ }
507
+ }
508
+ else:
509
+ params = {"model_id": 5, "prompt": query}
510
+ response = requests.post(url, params=params)
511
+ if response.status_code != 200:
512
+ return f"Error status: {response.status_code}"
513
+ check_response = response.json()
514
+ answer = check_response.get("content")
515
+ return {
516
+ "status": "true",
517
+ "randydev":{
518
+ "message": answer
519
  }
520
  }
 
 
521
 
522
  @app.get("/ryuzaki/freechatgpt-beta")
523
  def free_chatgpt4_beta(query: str):