randydev commited on
Commit
d282d9e
1 Parent(s): 8011b81

Upload 2 files

Browse files
Files changed (2) hide show
  1. main.py +23 -31
  2. models.py +4 -0
main.py CHANGED
@@ -68,7 +68,7 @@ from pymongo import MongoClient
68
 
69
  from RyuzakiLib.hackertools.chatgpt import RendyDevChat
70
  from RyuzakiLib.hackertools.gemini import GeminiLatest
71
- from RyuzakiLib.hackertools.openai_api import OpenAiToken
72
  from RyuzakiLib.hackertools.huggingface import FaceAI
73
 
74
  from RyuzakiLib.mental import BadWordsList
@@ -628,22 +628,6 @@ def chatgpt_olds(item: ChatgptCustom):
628
  except Exception as e:
629
  return SuccessResponse(status="False", randydev={"message": contact_support})
630
 
631
- @app.get("/ryuzaki/freechatgpt-beta", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
632
- def free_chatgpt4_beta(item: ChatgptCustom):
633
- try:
634
- response = RendyDevChat(item.query).get_response_beta(joke=True)
635
- return SuccessResponse(status="True", randydev={"message": response})
636
- except:
637
- return SuccessResponse(status="False", randydev={"message": contact_support})
638
-
639
- @app.get("/ryuzaki/freechatgpt-bing", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
640
- def free_chatgpt4_bing(item: ChatgptCustom):
641
- try:
642
- response = RendyDevChat(item.query).get_response_bing(bing=True)
643
- return SuccessResponse(status="True", randydev={"message": response})
644
- except:
645
- return SuccessResponse(status="False", randydev={"message": contact_support})
646
-
647
  @app.post("/ryuzaki/ai", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
648
  def ryuzaki_ai(
649
  item: RyuzakiAi,
@@ -861,20 +845,16 @@ def chatgpt3_turbo(
861
  if item.is_openai_original:
862
  try:
863
  GPTbase = SOURCE_OPENAI_ACCESS_URL
864
- response = OpenAiToken(api_key=item.api_key, api_base=GPTbase).chat_message_turbo(
865
  query=item.query,
866
  model=item.model,
867
  user_id=user_id,
868
  is_stream=item.is_stream
869
  )
870
- answer = response[0]
871
- continue_chat = response[1]
872
  return SuccessResponse(
873
  status="True",
874
- randydev={
875
- "message": answer,
876
- "chat_history": continue_chat
877
- }
878
  )
879
  except Exception:
880
  return SuccessResponse(status="False", randydev={"message": contact_support})
@@ -895,19 +875,31 @@ def chatgpt4_turbo(
895
  ):
896
  try:
897
  GPTbase = SOURCE_OPENAI_ACCESS_URL
898
- response = OpenAiToken(api_key=item.api_key, api_base=GPTbase).chat_message_turbo(
899
  query=item.query,
900
  model=item.model,
901
  is_stream=item.is_stream
902
  )
903
- answer = response[0]
904
- continue_chat = response[1]
905
  return SuccessResponse(
906
  status="True",
907
- randydev={
908
- "message": answer,
909
- "chat_history": continue_chat
910
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
911
  )
912
  except Exception:
913
  return SuccessResponse(status="False", randydev={"message": contact_support})
 
68
 
69
  from RyuzakiLib.hackertools.chatgpt import RendyDevChat
70
  from RyuzakiLib.hackertools.gemini import GeminiLatest
71
+ from RyuzakiLib.hackertools.openai_api import OpenAI
72
  from RyuzakiLib.hackertools.huggingface import FaceAI
73
 
74
  from RyuzakiLib.mental import BadWordsList
 
628
  except Exception as e:
629
  return SuccessResponse(status="False", randydev={"message": contact_support})
630
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
631
  @app.post("/ryuzaki/ai", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
632
  def ryuzaki_ai(
633
  item: RyuzakiAi,
 
845
  if item.is_openai_original:
846
  try:
847
  GPTbase = SOURCE_OPENAI_ACCESS_URL
848
+ response = await OpenAI(api_key=item.api_key, api_base=GPTbase).chat_message_turbo(
849
  query=item.query,
850
  model=item.model,
851
  user_id=user_id,
852
  is_stream=item.is_stream
853
  )
854
+ answer = response
 
855
  return SuccessResponse(
856
  status="True",
857
+ randydev={"message": answer}
 
 
 
858
  )
859
  except Exception:
860
  return SuccessResponse(status="False", randydev={"message": contact_support})
 
875
  ):
876
  try:
877
  GPTbase = SOURCE_OPENAI_ACCESS_URL
878
+ response = await OpenAI(api_key=item.api_key, api_base=GPTbase).chat_message_turbo(
879
  query=item.query,
880
  model=item.model,
881
  is_stream=item.is_stream
882
  )
883
+ answer = response
 
884
  return SuccessResponse(
885
  status="True",
886
+ randydev={"message": answer}
887
+ )
888
+ except Exception:
889
+ return SuccessResponse(status="False", randydev={"message": contact_support})
890
+
891
+ @app.post("/ryuzaki/chatgpt-custom", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
892
+ def chatgpt_customs(
893
+ item: ChatgptNewo,
894
+ api_key: None = Depends(validate_api_key)
895
+ ):
896
+ try:
897
+ GPTbase = SOURCE_OPENAI_ACCESS_URL
898
+ x = OpenAI(api_key=api_key, api_base=GPTbase)
899
+ response = await x.api_chat(query=item.query, model=item.model)
900
+ return SuccessResponse(
901
+ status="True",
902
+ randydev={"message": answer}
903
  )
904
  except Exception:
905
  return SuccessResponse(status="False", randydev={"message": contact_support})
models.py CHANGED
@@ -164,5 +164,9 @@ class Chatgpt3Texts(BaseModel):
164
  class TextCustom(BaseModel):
165
  query: str
166
 
 
 
 
 
167
  class Picsart(BaseModel):
168
  image_path: str
 
164
  class TextCustom(BaseModel):
165
  query: str
166
 
167
+ class ChatgptNewo(BaseModel):
168
+ query: str
169
+ model: str
170
+
171
  class Picsart(BaseModel):
172
  image_path: str