Skip to content

Commit

Permalink
removing unwanted prints
Browse files Browse the repository at this point in the history
  • Loading branch information
TransformerOptimus committed Jun 2, 2023
1 parent 4b1d494 commit 57d652a
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 24 deletions.
23 changes: 0 additions & 23 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ def authjwt_exception_handler(request: Request, exc: AuthJWTException):
if not organisation or organisation is None:
organisation = Organisation(id=1, name='Default Organization',
description='This is the default organization')
print("Org create.....")
session.add(organisation)
session.commit()

Expand Down Expand Up @@ -177,10 +176,8 @@ def load_module_from_file(file_path):
# Function to process the files and extract class information
def process_files(folder_path):
existing_tools = session.query(Tool).all()
# print("Exisiting Tool")
existing_tools = [Tool(id=None, name=tool.name, folder_name=tool.folder_name, class_name=tool.class_name) for tool
in existing_tools]
# print(existing_tools)

new_tools = []
# Iterate over all subfolders
Expand All @@ -192,20 +189,15 @@ def process_files(folder_path):
for file_name in os.listdir(folder_dir):
file_path = os.path.join(folder_dir, file_name)
if file_name.endswith(".py") and not file_name.startswith("__init__"):
# print(f"Folder = {folder_name} File = {file_name}")
# Get clasess
classes = get_classes_in_file(file_path=file_path)
# filtered_classes = [clazz for clazz in classes if
# clazz["class_name"].endswith("Tool") and clazz["class_name"] != "BaseTool"]
for clazz in classes:
# print("Class : ", clazz)
new_tool = Tool(class_name=clazz["class_name"], folder_name=folder_name, file_name=file_name,
name=clazz["class_attribute"])
new_tools.append(new_tool)

# print(existing_tools)
# print(new_tools)

for tool in new_tools:
add_or_update_tool(session, tool_name=tool.name, file_name=tool.file_name, folder_name=tool.folder_name,
class_name=tool.class_name)
Expand Down Expand Up @@ -250,7 +242,6 @@ def github_login():

@app.get('/github-auth')
def github_auth_handler(code: str = Query(...),Authorize: AuthJWT = Depends()):
print(code)
github_token_url = 'https://github.com/login/oauth/access_token'
github_client_id = ""
github_client_secret = ""
Expand All @@ -267,29 +258,22 @@ def github_auth_handler(code: str = Query(...),Authorize: AuthJWT = Depends()):
if response.ok:
data = response.json()
access_token = data.get('access_token')
print("Access Token : ", access_token)
github_api_url = 'https://api.github.com/user'
headers = {
'Authorization': f'Bearer {access_token}'
}
response = requests.get(github_api_url, headers=headers)
print("Response")
print(response)
if response.ok:
user_data = response.json()
print("USER :",user_data)
db_user: User = db.session.query(User).filter(User.email == user_data["email"]).first()
if db_user is None:
user = User(name=user_data["name"], email=user_data["email"])
db.session.add(user)
db.session.commit()
print("EMAIL : ", user_data["email"])
print("USER : ", user_data["login"])
if user_data["email"] is not None:
jwt_token = Authorize.create_access_token(user_data["email"])
else:
jwt_token = Authorize.create_access_token(user_data["login"])
print("JWT : ", jwt_token)
redirect_url_success = f"{frontend_url}?access_token={jwt_token}"
# redirect_url_success = "https://superagi.com/"
return RedirectResponse(url=redirect_url_success)
Expand Down Expand Up @@ -336,10 +320,3 @@ async def root(Authorize: AuthJWT = Depends()):
# # uvicorn main:app --host 0.0.0.0 --port 8001 --reload

# # from superagi.task_queue.celery_app import test_fucntion

# # @app.get("/test")
# # async def test():
# # print("Inside Test!")
# # test_fucntion.delay()
# # print("Test Done!")
# # return "Returned!"
1 change: 0 additions & 1 deletion superagi/vector_store/embedding/openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ async def get_embedding_async(self, text):
def get_embedding(self, text):
try:
openai.api_key = get_config("OPENAI_API_KEY")
print(openai.api_key)
response = openai.Embedding.create(
input=[text],
engine=self.model
Expand Down

0 comments on commit 57d652a

Please sign in to comment.