Spaces:
Running
Running
Update main.py
Browse files
main.py
CHANGED
@@ -844,7 +844,7 @@ async def chatgpt3_turbo(
|
|
844 |
):
|
845 |
if item.is_openai_original:
|
846 |
try:
|
847 |
-
GPTbase =
|
848 |
response = await OpenAI(api_key=item.api_key, api_base=GPTbase).chat_message_turbo(
|
849 |
query=item.query,
|
850 |
model=item.model,
|
@@ -856,8 +856,8 @@ async def chatgpt3_turbo(
|
|
856 |
status="True",
|
857 |
randydev={"message": answer}
|
858 |
)
|
859 |
-
except Exception:
|
860 |
-
return SuccessResponse(status="False", randydev={"message":
|
861 |
else:
|
862 |
url = "https://lexica.qewertyy.me/models"
|
863 |
params = {"model_id": 5, "prompt": item.query}
|
@@ -874,7 +874,7 @@ async def chatgpt4_turbo(
|
|
874 |
api_key: None = Depends(validate_api_key)
|
875 |
):
|
876 |
try:
|
877 |
-
GPTbase =
|
878 |
response = await OpenAI(api_key=item.api_key, api_base=GPTbase).chat_message_turbo(
|
879 |
query=item.query,
|
880 |
model=item.model,
|
@@ -885,8 +885,8 @@ async def chatgpt4_turbo(
|
|
885 |
status="True",
|
886 |
randydev={"message": answer}
|
887 |
)
|
888 |
-
except Exception:
|
889 |
-
return SuccessResponse(status="False", randydev={"message":
|
890 |
|
891 |
@app.post("/ryuzaki/chatgpt-custom", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
|
892 |
async def chatgpt_customs(
|
@@ -894,15 +894,15 @@ async def chatgpt_customs(
|
|
894 |
api_key: None = Depends(validate_api_key)
|
895 |
):
|
896 |
try:
|
897 |
-
GPTbase =
|
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":
|
906 |
|
907 |
@app.post("/ryuzaki/google-ai", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
|
908 |
def v1beta3_google_ai(
|
|
|
844 |
):
|
845 |
if item.is_openai_original:
|
846 |
try:
|
847 |
+
GPTbase = "https://gpt-api.mycloud.im/v1"
|
848 |
response = await OpenAI(api_key=item.api_key, api_base=GPTbase).chat_message_turbo(
|
849 |
query=item.query,
|
850 |
model=item.model,
|
|
|
856 |
status="True",
|
857 |
randydev={"message": answer}
|
858 |
)
|
859 |
+
except Exception as e:
|
860 |
+
return SuccessResponse(status="False", randydev={"message": str(e)})
|
861 |
else:
|
862 |
url = "https://lexica.qewertyy.me/models"
|
863 |
params = {"model_id": 5, "prompt": item.query}
|
|
|
874 |
api_key: None = Depends(validate_api_key)
|
875 |
):
|
876 |
try:
|
877 |
+
GPTbase = "https://gpt-api.mycloud.im/v1"
|
878 |
response = await OpenAI(api_key=item.api_key, api_base=GPTbase).chat_message_turbo(
|
879 |
query=item.query,
|
880 |
model=item.model,
|
|
|
885 |
status="True",
|
886 |
randydev={"message": answer}
|
887 |
)
|
888 |
+
except Exception as e:
|
889 |
+
return SuccessResponse(status="False", randydev={"message": str(e)})
|
890 |
|
891 |
@app.post("/ryuzaki/chatgpt-custom", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
|
892 |
async def chatgpt_customs(
|
|
|
894 |
api_key: None = Depends(validate_api_key)
|
895 |
):
|
896 |
try:
|
897 |
+
GPTbase = "https://gpt-api.mycloud.im/v1"
|
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 as e:
|
905 |
+
return SuccessResponse(status="False", randydev={"message": str(e)})
|
906 |
|
907 |
@app.post("/ryuzaki/google-ai", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
|
908 |
def v1beta3_google_ai(
|