randydev commited on
Commit
2dd8e14
1 Parent(s): 5abef5c

Upload 2 files

Browse files
Files changed (2) hide show
  1. main.py +8 -3
  2. models.py +1 -0
main.py CHANGED
@@ -659,12 +659,17 @@ def chatgpt4_turbo(
659
  GPTbase = SOURCE_OPENAI_ACCESS_URL
660
  response = OpenAiToken(api_key=item.api_key, api_base=GPTbase).chat_message_turbo(
661
  query=item.query,
662
- model="gpt-4-turbo"
 
663
  )
664
- answer = response["choices"][0]["message"]["content"]
 
665
  return SuccessResponse(
666
  status="True",
667
- randydev={"message": answer}
 
 
 
668
  )
669
 
670
  @app.post("/ryuzaki/google-ai", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
 
659
  GPTbase = SOURCE_OPENAI_ACCESS_URL
660
  response = OpenAiToken(api_key=item.api_key, api_base=GPTbase).chat_message_turbo(
661
  query=item.query,
662
+ model="gpt-4",
663
+ is_stream=item.is_stream
664
  )
665
+ answer = response[0]
666
+ continue_chat = response[1]
667
  return SuccessResponse(
668
  status="True",
669
+ randydev={
670
+ "message": answer,
671
+ "chat_history": continue_chat
672
+ }
673
  )
674
 
675
  @app.post("/ryuzaki/google-ai", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
models.py CHANGED
@@ -135,6 +135,7 @@ class AnimeStyled(BaseModel):
135
  class OpenaiTexts(BaseModel):
136
  query: str
137
  api_key: str
 
138
 
139
  class Chatgpt3Texts(BaseModel):
140
  query: str
 
135
  class OpenaiTexts(BaseModel):
136
  query: str
137
  api_key: str
138
+ is_stream: Optional[bool] = False
139
 
140
  class Chatgpt3Texts(BaseModel):
141
  query: str