Skip to content

Commit

Permalink
Merge pull request #82 from TeamKillerX/dev
Browse files Browse the repository at this point in the history
_
  • Loading branch information
xtsea committed Aug 30, 2024
2 parents 96fa48b + 91272ff commit 0b54910
Show file tree
Hide file tree
Showing 7 changed files with 118 additions and 13 deletions.
2 changes: 2 additions & 0 deletions RyuzakiLib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
from .extreme.quotestk import QouteSticker
from .extreme.userinfo import TelegramUserInfo
from .extreme.webshot import WebShotUrl
from .fastapi import FastAPISuper
from .hackertools.blackbox import Blackbox
from .hackertools.chatgpt import RendyDevChat
from .hackertools.cloudflare import CloudFlare
Expand Down Expand Up @@ -118,4 +119,5 @@ class AwesomeCoding(BaseModel):
"async_search",
"PornoHub",
"AkenoAI",
"FastAPISuper",
]
2 changes: 1 addition & 1 deletion RyuzakiLib/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.3.2"
__version__ = "1.3.3"
5 changes: 4 additions & 1 deletion RyuzakiLib/akenoai.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ async def signup(self, gmail: str, username: str):
return response

async def connect(self, username: str, requests_limit: int = 30):
response = await self.get_api_key(username)
response = await async_search(
f"{self.base_api_dev}/get_api_key?api_key={username}",
re_json=True
)
if response.get("requests_made", 0) >= requests_limit:
return "The limit has been reached"
else:
Expand Down
60 changes: 60 additions & 0 deletions RyuzakiLib/fastapi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
from authlib.integrations.starlette_client import OAuth
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from starlette.middleware.sessions import SessionMiddleware


class FastAPISuper:
def __init__(self, docs_url=None, redoc_url=None, config=None):
self.docs_url = docs_url
self.redoc_url = redoc_url
self.fastapi = FastAPI(docs_url=self.docs_url, redoc_url=self.redoc_url)
self.auth = OAuth(config)

def auth_register(
self,
auth0_client_id=None,
auth0_client_secrect=None,
auth0_domain=None,
domain_url=None
):
self.auth.register(
name="auth0",
client_id=auth0_client_id,
client_secret=auth0_client_secrect,
client_kwargs={
"scope": "openid profile email",
"redirect_url": f"{domain_url}/callback"
},
server_metadata_url=f"https://{auth0_domain}/.well-known/openid-configuration"
)

async def authorize_redirect(self, request=None, redirect_uri=None):
return await self.auth.auth0.authorize_redirect(
request,
redirect_uri=redirect_uri,
scope="openid profile email",
response_type="code"
)

async def authorize_access_token(self, request=None):
token = await self.auth.auth0.authorize_access_token(request)
return token

def moderator(self):
return self.fastapi

def add_session_middleware(self, secret_key=None):
self.fastapi.add_middleware(
SessionMiddleware,
secret_key=secret_key
)

def add_cors_middleware(self):
self.fastapi.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
56 changes: 45 additions & 11 deletions RyuzakiLib/hackertools/chatgpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,13 @@ async def chat_hacked(
mongo_url: Optional[str] = None,
system_prompt: Optional[str] = owner_base,
list_model_all: Optional[bool] = False
is_working_dev: Optional[bool] = False
):
if latest_model == "openai-v2":
url = f"{base_api_dev}/ryuzaki/chatgpt-old"
if is_working_dev:
url = f"{base_api_dev}/ryuzaki/chatgpt-old"
else:
url "https://randydev-ryuzaki-api.hf.space/ryuzaki/chatgpt-old"
params = {"query": args}
check_response = await AsyicXSearcher.search(
url,
Expand All @@ -67,7 +71,10 @@ async def chat_hacked(
)
return check_response["randydev"]["message"]
elif latest_model == "blackbox":
url = f"{base_api_dev}/ryuzaki/blackbox"
if is_working_dev:
url = f"{base_api_dev}/ryuzaki/blackbox"
else:
url = f"https://randydev-ryuzaki-api.hf.space/ryuzaki/blackbox"
params = {"query": args}
check_response = await AsyicXSearcher.search(
url,
Expand All @@ -89,7 +96,10 @@ async def chat_hacked(
else:
return "you can check set list_model_all=True"
elif latest_model == "gemini-pro":
url = f"https://randydev-ryuzaki-api.hf.space/ryuzaki/gemini-ai-pro"
if is_working_dev:
url = f"{base_api_dev}/ryuzaki/gemini-ai-pro"
else:
url = f"https://randydev-ryuzaki-api.hf.space/ryuzaki/gemini-ai-pro"
payload = {
"query": args,
"mongo_url": mongo_url,
Expand All @@ -106,7 +116,10 @@ async def chat_hacked(
)
return check_response["randydev"]["message"]
elif latest_model == "microsoft":
url = f"{base_api_dev}/ryuzaki/faceai"
if is_working_dev:
url = f"{base_api_dev}/ryuzaki/faceai"
else:
url = f"https://randydev-ryuzaki-api.hf.space/ryuzaki/faceai"
payload = {
"query": args,
"clients_name": "microsoft/Phi-3-mini-4k-instruct",
Expand All @@ -121,7 +134,10 @@ async def chat_hacked(
)
return check_response["randydev"]["message"]
elif latest_model == "gemma":
url = f"{base_api_dev}/ryuzaki/faceai"
if is_working_dev:
url = f"{base_api_dev}/ryuzaki/faceai"
else:
url = f"https://randydev-ryuzaki-api.hf.space/ryuzaki/faceai"
payload = {
"query": args,
"clients_name": "google/gemma-1.1-7b-it",
Expand All @@ -136,7 +152,10 @@ async def chat_hacked(
)
return check_response["randydev"]["message"]
elif latest_model == "mistralai":
url = f"{base_api_dev}/ryuzaki/faceai"
if is_working_dev:
url = f"{base_api_dev}/ryuzaki/faceai"
else:
url = f"https://randydev-ryuzaki-api.hf.space/ryuzaki/faceai"
payload = {
"query": args,
"clients_name": "mistralai/Mixtral-8x7B-Instruct-v0.1",
Expand All @@ -151,7 +170,10 @@ async def chat_hacked(
)
return check_response["randydev"]["message"]
elif latest_model == "faceh4":
url = f"{base_api_dev}/ryuzaki/faceai"
if is_working_dev:
url = f"{base_api_dev}/ryuzaki/faceai"
else:
url = f"https://randydev-ryuzaki-api.hf.space/ryuzaki/faceai"
payload = {
"query": args,
"clients_name": "HuggingFaceH4/zephyr-7b-beta",
Expand All @@ -166,7 +188,10 @@ async def chat_hacked(
)
return check_response["randydev"]["message"]
elif latest_model == "google-ai":
url = f"{base_api_dev}/ryuzaki/google-ai"
if is_working_dev:
url = f"{base_api_dev}/ryuzaki/google-ai"
else:
url = f"https://randydev-ryuzaki-api.hf.space/ryuzaki/google-ai"
headers = {"accept": "application/json", "api-key": API_KEYS}
params = {"query": args}
check_response = await AsyicXSearcher.search(
Expand All @@ -178,7 +203,10 @@ async def chat_hacked(
)
return check_response["randydev"]["message"]
elif latest_model == "betagoogle-ai":
url = f"{base_api_dev}/ryuzaki/v1beta2-google-ai"
if is_working_dev:
url = f"{base_api_dev}/ryuzaki/v1beta2-google-ai"
else:
url = "https://randydev-ryuzaki-api.hf.space/ryuzaki/v1beta2-google-ai"
headers = {"accept": "application/json", "api-key": API_KEYS}
params = {"query": args}
check_response = await AsyicXSearcher.search(
Expand All @@ -190,7 +218,10 @@ async def chat_hacked(
)
return check_response["randydev"]["message"]
elif latest_model == "gpt-4-turbo":
url = f"{base_api_dev}/ryuzaki/chatgpt-custom"
if is_working_dev:
url = f"{base_api_dev}/ryuzaki/chatgpt-custom"
else:
url = f"https://randydev-ryuzaki-api.hf.space/ryuzaki/chatgpt-custom"
headers = {"accept": "application/json", "api-key": API_KEYS}
params = {"query": args, "model": "gpt-4-turbo"}
check_response = await AsyicXSearcher.search(
Expand Down Expand Up @@ -223,7 +254,10 @@ def download_images(image_urls):

@staticmethod
async def image_generator(args):
url = f"{base_api_dev}/ryuzaki/dalle3xl"
if is_working_dev:
url = f"{base_api_dev}/ryuzaki/dalle3xl"
else:
url = f"https://randydev-ryuzaki-api.hf.space/ryuzaki/dalle3xl"
headers = {"accept": "application/json", "api-key": API_KEYS}
payload = {"query": args}
check_response = await AsyicXSearcher.search(
Expand Down
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ huggingface-hub>=0.23.2
motor
nest-asyncio
wget
uvicorn[standard
fastapi[all]
authlib
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ def read(fname, version=False):
"huggingface-hub>=0.23.2",
"motor",
"wget",
"uvicorn[standard",
"fastapi[all]",
"authlib",
],
classifiers=[
"Programming Language :: Python :: 3",
Expand Down

0 comments on commit 0b54910

Please sign in to comment.