randydev commited on
Commit
6965fc4
1 Parent(s): 1acd420

Upload main.py

Browse files
Files changed (1) hide show
  1. main.py +1 -73
main.py CHANGED
@@ -127,7 +127,7 @@ collection = db["users"]
127
 
128
  trans = SyncTranslator()
129
 
130
- app = FastAPI(docs_url="/docs", redoc_url="/")
131
  app.include_router(fluxai_router, prefix="/api/v1")
132
  app.include_router(whisper_router, prefix="/api/v1")
133
 
@@ -749,20 +749,6 @@ def ocr_space_url(
749
  except (json.JSONDecodeError, KeyError):
750
  return "Error parsing the OCR response."
751
 
752
- @app.get("/ryuzaki/nochatgpt", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
753
- def no_chatgpt(query: str=None):
754
- try:
755
- url = "http://216.98.10.228:5000"
756
- api_method = f"{url}/gpt?ask={query}"
757
- response = requests.get(api_method)
758
- if response.status_code != 200:
759
- return SuccessResponse(status="False", randydev={"message": contact_support})
760
- return SuccessResponse(status="True", randydev={"message": response.text})
761
- except requests.exceptions.ConnectTimeout:
762
- return SuccessResponse(status="False", randydev={"message": contact_support})
763
- except Exception as e:
764
- return SuccessResponse(status="False", randydev={"message": contact_support})
765
-
766
  @app.post("/ryuzaki/chatgpt-old", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
767
  def chatgpt_olds(item: ChatgptCustom):
768
  try:
@@ -978,26 +964,6 @@ def image_unsplash(item: GetImageUnsplash):
978
  else:
979
  return SuccessResponse(status="False", randydev={"data": "Not found image data"})
980
 
981
- @app.post("/ryuzaki/chatgpt-model", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
982
- def chatgpt_model(item: ChatgptModel):
983
- url = "https://lexica.qewertyy.me/models"
984
- if item.is_models:
985
- params = {"model_id": item.model_id, "prompt": item.query}
986
- response = requests.post(url, params=params)
987
- if response.status_code != 200:
988
- return SuccessResponse(status="False", randydev={"message": contact_support})
989
- check_response = response.json()
990
- answer = check_response.get("content")
991
- return SuccessResponse(status="True", randydev={"message": answer})
992
- else:
993
- params = {"model_id": 5, "prompt": item.query}
994
- response = requests.post(url, params=params)
995
- if response.status_code != 200:
996
- return SuccessResponse(status="False", randydev={"message": contact_support})
997
- check_response = response.json()
998
- answer = check_response.get("content")
999
- return SuccessResponse(status="True", randydev={"message": answer})
1000
-
1001
  @app.post("/ryuzaki/chatgpt3-turbo", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
1002
  async def chatgpt3_turbo(
1003
  item: Chatgpt3Texts,
@@ -1030,42 +996,6 @@ async def chatgpt3_turbo(
1030
  answer = check_response.get("content")
1031
  return SuccessResponse(status="True", randydev={"message": answer})
1032
 
1033
- @app.post("/ryuzaki/chatgpt4-turbo", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
1034
- async def chatgpt4_turbo(
1035
- item: OpenaiTexts,
1036
- api_key: None = Depends(validate_api_key)
1037
- ):
1038
- try:
1039
- GPTbase = "https://gpt-api.mycloud.im/v1"
1040
- response = await OpenAI(api_key=item.api_key, api_base=GPTbase).chat_message_turbo(
1041
- query=item.query,
1042
- model=item.model,
1043
- is_stream=item.is_stream
1044
- )
1045
- answer = response
1046
- return SuccessResponse(
1047
- status="True",
1048
- randydev={"message": answer}
1049
- )
1050
- except Exception as e:
1051
- return SuccessResponse(status="False", randydev={"message": str(e)})
1052
-
1053
- @app.post("/ryuzaki/chatgpt-4o", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
1054
- async def chatgpt_4o(
1055
- item: ChatgptCustom,
1056
- api_key: None = Depends(validate_api_key)
1057
- ):
1058
- client = Client()
1059
- response = client.chat.completions.create(
1060
- model="gpt-4o",
1061
- messages=[{"role": "user", "content": item.query}],
1062
- )
1063
- answer = response.choices[0].message.content
1064
- return SuccessResponse(
1065
- status="True",
1066
- randydev={"message": answer}
1067
- )
1068
-
1069
  @app.post("/ryuzaki/chatgpt-custom", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
1070
  async def chatgpt_customs(
1071
  item: ChatgptNewo,
@@ -1703,8 +1633,6 @@ def myfile(item: DownloadLink):
1703
  return {'status': 'false', 'message': 'Invalid Link'}
1704
 
1705
  description = """
1706
- - Ryuzaki Library: [Library Here](https://github.com/TeamKillerX/RyuzakiLib)
1707
-
1708
  •Developed by [@xtdevs](https://t.me/xtdevs)
1709
  """
1710
 
 
127
 
128
  trans = SyncTranslator()
129
 
130
+ app = FastAPI(docs_url=None, redoc_url="/")
131
  app.include_router(fluxai_router, prefix="/api/v1")
132
  app.include_router(whisper_router, prefix="/api/v1")
133
 
 
749
  except (json.JSONDecodeError, KeyError):
750
  return "Error parsing the OCR response."
751
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
752
  @app.post("/ryuzaki/chatgpt-old", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
753
  def chatgpt_olds(item: ChatgptCustom):
754
  try:
 
964
  else:
965
  return SuccessResponse(status="False", randydev={"data": "Not found image data"})
966
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
967
  @app.post("/ryuzaki/chatgpt3-turbo", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
968
  async def chatgpt3_turbo(
969
  item: Chatgpt3Texts,
 
996
  answer = check_response.get("content")
997
  return SuccessResponse(status="True", randydev={"message": answer})
998
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
999
  @app.post("/ryuzaki/chatgpt-custom", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
1000
  async def chatgpt_customs(
1001
  item: ChatgptNewo,
 
1633
  return {'status': 'false', 'message': 'Invalid Link'}
1634
 
1635
  description = """
 
 
1636
  •Developed by [@xtdevs](https://t.me/xtdevs)
1637
  """
1638