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 31 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
9 changes: 7 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,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.api_key import router as 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 @@ -52,7 +55,6 @@
from superagi.models.workflows.agent_workflow import AgentWorkflow
from superagi.models.workflows.iteration_workflow import IterationWorkflow
from superagi.models.workflows.iteration_workflow_step import IterationWorkflowStep

app = FastAPI()

database_url = get_config('POSTGRES_URL')
Expand Down Expand Up @@ -116,7 +118,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(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 @@ -364,3 +368,4 @@ def github_client_id():

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

65 changes: 65 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,65 @@
"""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 = '2fbd6472112c'
branch_labels = None
depends_on = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('api_keys',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('org_id', sa.Integer(), nullable=True),
sa.Column('name', sa.String(), nullable=True),
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('is_expired',sa.Boolean(),nullable=True,default=False),
sa.PrimaryKeyConstraint('id')
)
op.create_table('webhooks',
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('is_deleted',sa.Boolean(),nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_table('webhook_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('webhooks')
op.drop_table('api_keys')
op.drop_table('webhook_events')

# ### end Alembic commands ###
Loading