Spaces:
Running
Running
Update main.py
Browse files
main.py
CHANGED
@@ -524,20 +524,20 @@ def chatgpt_olds(query: str=None):
|
|
524 |
"Sec-Fetch-Site": "cross-site",
|
525 |
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Edge/17.17134"
|
526 |
}
|
527 |
-
|
528 |
try:
|
529 |
url = SOURCE_CHATGPT_OLD_URL
|
530 |
-
response = requests.post(url, data=json.dumps(
|
531 |
if response.status_code != 200:
|
532 |
return SuccessResponse(status="False", randydev={"message": contact_support})
|
533 |
body = ""
|
534 |
for i in response.json()["choices"]:
|
535 |
body += i["message"]["content"]
|
536 |
-
|
537 |
-
except requests.exceptions.ConnectTimeout:
|
538 |
-
return SuccessResponse(status="False", randydev={"message":
|
539 |
except Exception as e:
|
540 |
-
return SuccessResponse(status="False", randydev={"message":
|
541 |
|
542 |
@app.get("/ryuzaki/freechatgpt-beta", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
|
543 |
def free_chatgpt4_beta(item: ChatgptCustom):
|
|
|
524 |
"Sec-Fetch-Site": "cross-site",
|
525 |
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Edge/17.17134"
|
526 |
}
|
527 |
+
data = {"prompt": query}
|
528 |
try:
|
529 |
url = SOURCE_CHATGPT_OLD_URL
|
530 |
+
response = requests.post(url, data=json.dumps(data), headers=headers, timeout=50000)
|
531 |
if response.status_code != 200:
|
532 |
return SuccessResponse(status="False", randydev={"message": contact_support})
|
533 |
body = ""
|
534 |
for i in response.json()["choices"]:
|
535 |
body += i["message"]["content"]
|
536 |
+
return SuccessResponse(status="True", randydev={"message": body})
|
537 |
+
except requests.exceptions.ConnectTimeout as e:
|
538 |
+
return SuccessResponse(status="False", randydev={"message": e})
|
539 |
except Exception as e:
|
540 |
+
return SuccessResponse(status="False", randydev={"message": e})
|
541 |
|
542 |
@app.get("/ryuzaki/freechatgpt-beta", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
|
543 |
def free_chatgpt4_beta(item: ChatgptCustom):
|