Ufoptg commited on
Commit
9a2c0f7
1 Parent(s): 65bba6a

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +6 -44
main.py CHANGED
@@ -16,6 +16,7 @@
16
  #
17
  # You should have received a copy of the GNU Affero General Public License
18
  # along with this program. If not, see <https://www.gnu.org/licenses/>.
 
19
  import requests
20
  import json
21
  import base64
@@ -24,19 +25,17 @@ import uvicorn
24
  import os
25
  import shutil
26
  import random
 
27
  import tempfile
28
  import io
29
- import openai
30
  from io import BytesIO
31
  from datetime import datetime as dt
32
  from dotenv import load_dotenv
33
  from bs4 import BeautifulSoup
34
 
35
- from typing import *
36
  from typing_extensions import Annotated
37
  from typing import Annotated, Union
38
- from typing import Optional, List, Dict, Any
39
-
40
 
41
  from pydantic import BaseModel
42
  from base64 import b64decode as kc
@@ -48,10 +47,9 @@ from telegraph import Telegraph, upload_file
48
  from pathlib import Path
49
  from serpapi import GoogleSearch
50
 
51
- from fastapi import FastAPI, UploadFile, File, Response
52
  from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm
53
  from fastapi import Depends, FastAPI, HTTPException, status
54
- from fastapi.openapi.utils import get_openapi
55
  from fastapi.responses import StreamingResponse
56
  from fastapi import HTTPException
57
  from fastapi import FastAPI, Request, Header
@@ -60,20 +58,13 @@ from fastapi.staticfiles import StaticFiles
60
  from fastapi.templating import Jinja2Templates
61
  from fastapi.responses import FileResponse
62
 
63
- from pymongo import MongoClient
64
-
65
  from RyuzakiLib.hackertools.chatgpt import RendyDevChat
66
  from RyuzakiLib.hackertools.openai_api import OpenAiToken
67
  from RyuzakiLib.mental import BadWordsList
68
- from RyuzakiLib.system import OpenReadSystem
69
-
70
- from bardapi import Bard
71
-
72
- from models import *
73
-
74
- from gpytranslate import SyncTranslator
75
 
76
  import logging
 
77
  import functions as code
78
 
79
  logging.basicConfig(level=logging.ERROR)
@@ -233,35 +224,6 @@ def ryuzaki_ai(
233
  except Exception as e:
234
  return {"status": "false", "message": f"error: {e}"}
235
 
236
- @app.post("/ryuzaki/google-ai", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
237
- def v1beta3_google_ai(
238
- item: ChatgptCustom,
239
- api_key: None = Depends(validate_api_key)
240
- ):
241
- url = SOURCE_ASSISTANT_GOOGLE_AI
242
- token = ASSISTANT_GOOGLE_API_KEYS
243
- api_url = f"{SOURCE_ASSISTANT_GOOGLE_AI}/v1beta3/models/text-bison-001:generateText?key={ASSISTANT_GOOGLE_API_KEYS}"
244
- try:
245
- headers = {"Content-Type": "application/json"}
246
- data = {
247
- "prompt": {
248
- "text": item.query
249
- }
250
- }
251
- response = requests.post(api_url, headers=headers, json=data)
252
- response_str = response.json()
253
- answer = response_str["candidates"]
254
- for results in answer:
255
- message = results.get("output")
256
- return SuccessResponse(
257
- status="True",
258
- randydev={
259
- "message": message
260
- }
261
- )
262
- except:
263
- return {"status": "false", "message": "Error response."}
264
-
265
  @app.get("/ryuzaki/unsplash")
266
  async def get_image_unsplash(query: str, size: str="500x500"):
267
  url = SOURCE_UNSPLASH_URL
 
16
  #
17
  # You should have received a copy of the GNU Affero General Public License
18
  # along with this program. If not, see <https://www.gnu.org/licenses/>.
19
+
20
  import requests
21
  import json
22
  import base64
 
25
  import os
26
  import shutil
27
  import random
28
+ import g4f
29
  import tempfile
30
  import io
 
31
  from io import BytesIO
32
  from datetime import datetime as dt
33
  from dotenv import load_dotenv
34
  from bs4 import BeautifulSoup
35
 
36
+ from typing import Union
37
  from typing_extensions import Annotated
38
  from typing import Annotated, Union
 
 
39
 
40
  from pydantic import BaseModel
41
  from base64 import b64decode as kc
 
47
  from pathlib import Path
48
  from serpapi import GoogleSearch
49
 
50
+ from fastapi import FastAPI, UploadFile, File
51
  from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm
52
  from fastapi import Depends, FastAPI, HTTPException, status
 
53
  from fastapi.responses import StreamingResponse
54
  from fastapi import HTTPException
55
  from fastapi import FastAPI, Request, Header
 
58
  from fastapi.templating import Jinja2Templates
59
  from fastapi.responses import FileResponse
60
 
 
 
61
  from RyuzakiLib.hackertools.chatgpt import RendyDevChat
62
  from RyuzakiLib.hackertools.openai_api import OpenAiToken
63
  from RyuzakiLib.mental import BadWordsList
64
+ from RyuzakiLib.spamwatch.clients import SibylBan
 
 
 
 
 
 
65
 
66
  import logging
67
+ import database as db
68
  import functions as code
69
 
70
  logging.basicConfig(level=logging.ERROR)
 
224
  except Exception as e:
225
  return {"status": "false", "message": f"error: {e}"}
226
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
227
  @app.get("/ryuzaki/unsplash")
228
  async def get_image_unsplash(query: str, size: str="500x500"):
229
  url = SOURCE_UNSPLASH_URL