Spaces:
Running
Running
Upload main.py
Browse files
main.py
CHANGED
@@ -102,7 +102,6 @@ SOURCE_ASSISTANT_GOOGLE_AI = os.environ["SOURCE_ASSISTANT_GOOGLE_AI"]
|
|
102 |
SOURCE_MONITOR_URL = os.environ["SOURCE_MONITOR_URL"]
|
103 |
SOURCE_OPENAI_ACCESS_URL = os.environ["SOURCE_OPENAI_ACCESS_URL"]
|
104 |
SOURCE_PICSART_URL = os.environ["SOURCE_PICSART_URL"]
|
105 |
-
SOURCE_CHATGPT_OLD_URL = os.environ["SOURCE_CHATGPT_OLD_URL"]
|
106 |
|
107 |
# api keys
|
108 |
REVERSE_IMAGE_API = os.environ["REVERSE_IMAGE_API"]
|
@@ -511,33 +510,31 @@ def no_chatgpt(query: str=None):
|
|
511 |
return SuccessResponse(status="False", randydev={"message": contact_support})
|
512 |
|
513 |
@app.post("/ryuzaki/chatgpt-old", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
|
514 |
-
def chatgpt_olds(
|
515 |
-
headers = {
|
516 |
-
"Accept": "application/json",
|
517 |
-
"Content-Type": "application/json",
|
518 |
-
"Accept-Language": "en",
|
519 |
-
"Connection": "keep-alive",
|
520 |
-
"Origin": "https://remix.ethereum.org",
|
521 |
-
"Referer": "https://remix.ethereum.org/",
|
522 |
-
"Sec-Fetch-Dest": "empty",
|
523 |
-
"Sec-Fetch-Mode": "cors",
|
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 |
-
|
530 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
531 |
if response.status_code != 200:
|
532 |
return SuccessResponse(status="False", randydev={"message": contact_support})
|
533 |
-
|
534 |
-
|
535 |
-
|
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":
|
541 |
|
542 |
@app.get("/ryuzaki/freechatgpt-beta", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
|
543 |
def free_chatgpt4_beta(item: ChatgptCustom):
|
@@ -550,7 +547,7 @@ def free_chatgpt4_beta(item: ChatgptCustom):
|
|
550 |
@app.get("/ryuzaki/freechatgpt-bing", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
|
551 |
def free_chatgpt4_bing(item: ChatgptCustom):
|
552 |
try:
|
553 |
-
response = RendyDevChat(query).get_response_bing(bing=True)
|
554 |
return SuccessResponse(status="True", randydev={"message": response})
|
555 |
except:
|
556 |
return SuccessResponse(status="False", randydev={"message": contact_support})
|
|
|
102 |
SOURCE_MONITOR_URL = os.environ["SOURCE_MONITOR_URL"]
|
103 |
SOURCE_OPENAI_ACCESS_URL = os.environ["SOURCE_OPENAI_ACCESS_URL"]
|
104 |
SOURCE_PICSART_URL = os.environ["SOURCE_PICSART_URL"]
|
|
|
105 |
|
106 |
# api keys
|
107 |
REVERSE_IMAGE_API = os.environ["REVERSE_IMAGE_API"]
|
|
|
510 |
return SuccessResponse(status="False", randydev={"message": contact_support})
|
511 |
|
512 |
@app.post("/ryuzaki/chatgpt-old", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
|
513 |
+
def chatgpt_olds(item: ChatgptCustom):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
514 |
try:
|
515 |
+
headers = {
|
516 |
+
"Accept": "application/json",
|
517 |
+
"Content-Type": "application/json",
|
518 |
+
"Accept-Language": "en",
|
519 |
+
"Connection": "keep-alive",
|
520 |
+
"Origin": "https://remix.ethereum.org/",
|
521 |
+
"Referer": "https://remix.ethereum.org/",
|
522 |
+
"Sec-Fetch-Dest": "empty",
|
523 |
+
"Sec-Fetch-Mode": "cors",
|
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 |
+
payload = {"prompt": item.query}
|
528 |
+
type_urls = "openai-gpt"
|
529 |
+
url = f"https://{type_urls}.remixproject.org"
|
530 |
+
response = requests.post(url, data=json.dumps(payload), headers=headers, timeout=50000)
|
531 |
if response.status_code != 200:
|
532 |
return SuccessResponse(status="False", randydev={"message": contact_support})
|
533 |
+
return SuccessResponse(status="True", randydev={"message": response.json()["choices"][0]["message"]["content"]})
|
534 |
+
except requests.exceptions.ConnectTimeout:
|
535 |
+
return SuccessResponse(status="False", randydev={"message": contact_support})
|
|
|
|
|
|
|
536 |
except Exception as e:
|
537 |
+
return SuccessResponse(status="False", randydev={"message": contact_support})
|
538 |
|
539 |
@app.get("/ryuzaki/freechatgpt-beta", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
|
540 |
def free_chatgpt4_beta(item: ChatgptCustom):
|
|
|
547 |
@app.get("/ryuzaki/freechatgpt-bing", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
|
548 |
def free_chatgpt4_bing(item: ChatgptCustom):
|
549 |
try:
|
550 |
+
response = RendyDevChat(item.query).get_response_bing(bing=True)
|
551 |
return SuccessResponse(status="True", randydev={"message": response})
|
552 |
except:
|
553 |
return SuccessResponse(status="False", randydev={"message": contact_support})
|