Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Super agi api #992

Merged
merged 72 commits into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
c112071
added create-api-key route
Aryan-Singh-14 Jul 29, 2023
b32c737
added models
Aryan-Singh-14 Jul 29, 2023
e848831
API key generation and authentication logic added
Aryan-Singh-14 Jul 31, 2023
41c3c8e
added event listener
Aryan-Singh-14 Jul 31, 2023
91bb8ea
added events
Aryan-Singh-14 Jul 31, 2023
59d2e52
added webhook logic
Aryan-Singh-14 Aug 1, 2023
ff9731d
fixed nonetype issue
Aryan-Singh-14 Aug 1, 2023
ce6256e
add get_organisation_from_api_key
Fluder-Paradyne Aug 1, 2023
6602de2
refactored agent.py
Aryan-Singh-14 Aug 1, 2023
3948353
pause agent,resume agent and get run resources api added
Aryan-Singh-14 Aug 4, 2023
41e1161
removed gui/app/api changes
Aryan-Singh-14 Aug 4, 2023
b222b12
removed ast import (not required in code)
Aryan-Singh-14 Aug 4, 2023
6aa9eae
code refactored
Aryan-Singh-14 Aug 5, 2023
0aed37b
removed comments
Aryan-Singh-14 Aug 5, 2023
637abf1
changed name of fnction in worker.py
Aryan-Singh-14 Aug 5, 2023
9674937
reverted changes in controllers/agent.py
Aryan-Singh-14 Aug 5, 2023
7d74569
added error handling in get_tool_and_toolkit_arr
Aryan-Singh-14 Aug 5, 2023
c31e4fb
removed test_app.py
Aryan-Singh-14 Aug 5, 2023
4f510ba
Merge branch 'dev' of github.com:TransformerOptimus/SuperAGI into sup…
Aryan-Singh-14 Aug 7, 2023
60ce35f
moved logic to models
Aryan-Singh-14 Aug 7, 2023
11a2c37
made changes according to comments of code review
Aryan-Singh-14 Aug 8, 2023
257e062
reverted tools.json changes
Aryan-Singh-14 Aug 8, 2023
c104377
removed whitespaces
Aryan-Singh-14 Aug 8, 2023
fe8ef22
variable renamed, queries optimised and code refactored
Aryan-Singh-14 Aug 9, 2023
90f00ce
api keys frontend, key addition done
namansleeps2 Aug 9, 2023
521d803
removed unused imports
Aryan-Singh-14 Aug 9, 2023
e9f6818
revert tools.json
Aryan-Singh-14 Aug 9, 2023
1b35814
Added get all api keys, delete api key by id and edit api key by id
Aryan-Singh-14 Aug 9, 2023
bcea2c0
renamed controller names
Aryan-Singh-14 Aug 9, 2023
371ed8a
removed unused imports
Aryan-Singh-14 Aug 9, 2023
6d5be27
added error handling in end points which use s3
Aryan-Singh-14 Aug 10, 2023
84f945e
Merge branch 'superAGI_api' of github.com:TransformerOptimus/SuperAGI…
namansleeps2 Aug 10, 2023
4714bfb
error handling added
Aryan-Singh-14 Aug 10, 2023
ff0ea96
creation and displaying of api keys completed
namansleeps2 Aug 10, 2023
b69745f
creation and displaying of api keys completed 2
namansleeps2 Aug 10, 2023
58186f6
test cases added for model functions and end points
Aryan-Singh-14 Aug 14, 2023
3bede4d
renamed update_api_key function
Aryan-Singh-14 Aug 14, 2023
cd2c4f6
resolved a simple merge conflict-1
Aryan-Singh-14 Aug 14, 2023
b4d17a3
added new line
Aryan-Singh-14 Aug 14, 2023
2bcec88
making classes
namansleeps2 Aug 16, 2023
9e06dfd
minor changes
namansleeps2 Aug 16, 2023
fe09e4b
Merge branch 'dev' into superAGI_api
Fluder-Paradyne Aug 16, 2023
8b1b85a
minor changes and complete
namansleeps2 Aug 16, 2023
ebf49ea
fixed indentation
Aryan-Singh-14 Aug 16, 2023
1ec0f06
fixed indentation
Aryan-Singh-14 Aug 16, 2023
818f7ba
Merge branch 'superAGI_api' of github.com:TransformerOptimus/SuperAGI…
Aryan-Singh-14 Aug 16, 2023
c9a5ab1
fixed minor issue
Aryan-Singh-14 Aug 16, 2023
aed8cbd
removed backslash
Aryan-Singh-14 Aug 16, 2023
bf6c257
merge dev
Aryan-Singh-14 Aug 16, 2023
bf544eb
Delete test_path
Aryan-Singh-14 Aug 16, 2023
aaba9e6
fixed tests
Aryan-Singh-14 Aug 16, 2023
d7886c3
Merge remote-tracking branch 'origin/superAGI_api' into superAGI_api
Aryan-Singh-14 Aug 16, 2023
767e472
Merge remote-tracking branch 'origin/dev' into superAGI_api
Aryan-Singh-14 Aug 16, 2023
99946a9
fixed tests
Aryan-Singh-14 Aug 16, 2023
2a1509b
fixed tests
Aryan-Singh-14 Aug 16, 2023
622db7b
fixed tests
Aryan-Singh-14 Aug 16, 2023
5211200
fixed tests
Aryan-Singh-14 Aug 16, 2023
3b4427f
fixed tests
Aryan-Singh-14 Aug 16, 2023
1061bb8
merged UI changes
Aryan-Singh-14 Aug 16, 2023
22cc81a
merged UI changes
Aryan-Singh-14 Aug 16, 2023
2dbeaaf
route change
Fluder-Paradyne Aug 16, 2023
a1adb59
Merge branch 'superAGI_api' of github.com:TransformerOptimus/SuperAGI…
Aryan-Singh-14 Aug 16, 2023
a804294
tweaked routes
Aryan-Singh-14 Aug 16, 2023
431338a
merged dev
Aryan-Singh-14 Aug 16, 2023
068c724
minor changes
namansleeps2 Aug 17, 2023
147b94f
minor changes for PR
namansleeps2 Aug 17, 2023
eecb369
minor changes for PR
namansleeps2 Aug 17, 2023
7e83202
minor fixes
namansleeps2 Aug 17, 2023
16800ab
minor fixes
namansleeps2 Aug 17, 2023
dde538f
minor fixes
namansleeps2 Aug 17, 2023
c859e5e
fix test
Fluder-Paradyne Aug 17, 2023
b5103f0
Merge branch 'superAGI_api' of https://github.com/TransformerOptimus/…
Fluder-Paradyne Aug 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from fastapi_jwt_auth.exceptions import AuthJWTException
from fastapi_sqlalchemy import DBSessionMiddleware, db
from pydantic import BaseModel
from sqlalchemy import create_engine
from sqlalchemy import create_engine, event
from sqlalchemy.orm import sessionmaker

import superagi
Expand Down Expand Up @@ -47,6 +47,9 @@
from superagi.controllers.vector_dbs import router as vector_dbs_router
from superagi.controllers.vector_db_indices import router as vector_db_indices_router
from superagi.controllers.marketplace_stats import router as marketplace_stats_router
from superagi.controllers.create_api_key import router as create_api_key_router
from superagi.controllers.api.agent import router as api_agent_router
from superagi.controllers.webhook import router as web_hook_router
from superagi.helper.tool_helper import register_toolkits, register_marketplace_toolkits
from superagi.lib.logger import logger
from superagi.llms.google_palm import GooglePalm
Expand All @@ -61,7 +64,10 @@
from superagi.models.types.login_request import LoginRequest
from superagi.models.types.validate_llm_api_key_request import ValidateAPIKeyRequest
from superagi.models.user import User

from superagi.models.agent_execution import AgentExecution
from superagi.helper.webhook_manager import WebHookManager
from superagi.models.db import connect_db
from superagi.worker import webhook_callback
app = FastAPI()

database_url = get_config('POSTGRES_URL')
Expand Down Expand Up @@ -125,7 +131,9 @@
app.include_router(vector_dbs_router, prefix="/vector_dbs")
app.include_router(vector_db_indices_router, prefix="/vector_db_indices")
app.include_router(marketplace_stats_router, prefix="/marketplace")

app.include_router(create_api_key_router,prefix="/api-keys")
app.include_router(api_agent_router,prefix="/v1/agent")
app.include_router(web_hook_router,prefix="/webhook")

# in production you can use Settings management
# from pydantic to get secret key from .env
Expand Down Expand Up @@ -484,3 +492,4 @@ async def say_hello(name: str, Authorize: AuthJWT = Depends()):

# # __________________TO RUN____________________________
# # uvicorn main:app --host 0.0.0.0 --port 8001 --reload

64 changes: 64 additions & 0 deletions migrations/versions/446884dcae58_add_api_key_and_web_hook.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
"""add api_key and web_hook

Revision ID: 446884dcae58
Revises: 71e3980d55f5
Create Date: 2023-07-29 10:55:21.714245

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '446884dcae58'
down_revision = '71e3980d55f5'
branch_labels = None
depends_on = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('api_key',
Aryan-Singh-14 marked this conversation as resolved.
Show resolved Hide resolved
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('org_id', sa.Integer(), nullable=True),
sa.Column('key_name', sa.String(), nullable=True),
Aryan-Singh-14 marked this conversation as resolved.
Show resolved Hide resolved
sa.Column('key', sa.String(), nullable=True),
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.Column('updated_at', sa.DateTime(), nullable=True),
sa.Column('revoked',sa.Boolean(),nullable=True,default=False),
Aryan-Singh-14 marked this conversation as resolved.
Show resolved Hide resolved
sa.PrimaryKeyConstraint('id')
)
op.create_table('web_hooks',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(), nullable=True),
sa.Column('org_id', sa.Integer(), nullable=True),
sa.Column('url', sa.String(), nullable=True),
sa.Column('headers', sa.JSON(), nullable=True),
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.Column('updated_at', sa.DateTime(), nullable=True),
sa.Column('isDeleted',sa.Boolean(),nullable=True),
Aryan-Singh-14 marked this conversation as resolved.
Show resolved Hide resolved
sa.PrimaryKeyConstraint('id')
)
op.create_table('web_hook_events',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('agent_id', sa.Integer(), nullable=True),
sa.Column('run_id', sa.Integer(), nullable=True),
sa.Column('event', sa.String(), nullable=True),
sa.Column('status', sa.String(), nullable=True),
sa.Column('errors', sa.Text(), nullable=True),
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.Column('updated_at', sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint('id')
)

#add index *********************
# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###

op.drop_table('web_hooks')
Aryan-Singh-14 marked this conversation as resolved.
Show resolved Hide resolved
op.drop_table('api_key')
op.drop_table('web_hook_events')
# ### end Alembic commands ###
Loading