Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
13 changes: 0 additions & 13 deletions backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,3 @@ To add a new model:
alembic revision --autogenerate -m "Add new model"
alembic upgrade head
```

## Celery

Celery is used to run tasks asynchronously.

## Flower

Flower is used to visualize the Celery tasks.

```
http://localhost:5555/
```

6 changes: 3 additions & 3 deletions backend/app/portia_impl/github_actions/github_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def run(self, context:ToolRunContext, error_logs: List[str], human_decision: Lit
class ListGitHubRepos(Tool):
id: str = "list_github_repos"
name: str = "list_github_repos"
description: str = "List all GitHub repositories for a given user."
description: str = "List all GitHub repositories for a given owner/user."
args_schema: type[BaseModel] = ListReposSchema
output_schema: tuple[str, str] = ("List", "List repositories for a user or the authenticated account")

Expand All @@ -129,9 +129,9 @@ def run(self, _:ToolRunContext, user: str) -> Any:
class ListGitHubRepoFiles(Tool):
id: str = "list_github_repo_files"
name: str = "list_github_repo_files"
description: str = "List files in a GitHub repository at a given path."
description: str = "List all files in a GitHub repository at a given path."
args_schema: type[BaseModel] = ListFilesSchema
output_schema: tuple[str, str] = ("List", "List files in a repository at a given path")
output_schema: tuple[str, str] = ("List", "List of files in a repository at a given path")

def run(self, _:ToolRunContext, repo: str, path: str = "") -> Any:
client = GitHubClientManager.get_client()
Expand Down
44 changes: 22 additions & 22 deletions backend/app/portia_impl/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,14 @@
InMemoryToolRegistry,
LLMModel,
LLMProvider,
Plan,
Portia,
StorageClass,
PortiaToolRegistry,
StorageClass,
PlanRunState,
example_tool_registry
PlanRunState
)
from portia.storage import PortiaCloudStorage
from github_actions import *
from aws_actions import *
from .github_actions import *
from .aws_actions import *

github_tools = InMemoryToolRegistry.from_local_tools([
# InitializeGitHubClient(),
Expand All @@ -40,11 +37,12 @@
load_dotenv()

ANTHROPIC_API_KEY = os.getenv('ANTHROPIC_API_KEY')
OPENAI_API_KEY = os.getenv('OPENAI_API_KEY')

anthropic_config = Config.from_default(
llm_provider=LLMProvider.ANTHROPIC,
llm_model_name=LLMModel.CLAUDE_3_5_SONNET,
anthropic_api_key=ANTHROPIC_API_KEY,
llm_provider=LLMProvider.OPENAI,
llm_model_name=LLMModel.GPT_4_O,
anthropic_api_key=OPENAI_API_KEY,
storage_class=StorageClass.CLOUD
)

Expand Down Expand Up @@ -89,23 +87,29 @@ def create_plan():

REPO_NAME = os.getenv('GITHUB_REPO')

HEAD_BRANCH = os.getenv("HEAD_BRANCH")
BASE_BRANCH = os.getenv("BASE_BRANCH")


query = """
1. List the log groups
2. then select the first log group
3. then list all the log streams for that group
4. then listen for error logs in that most recent stream
5. if there are any error logs, as in the list is not empty, ask the user on how to handle this via either creating a PR or an ISSUE using the on_error_log_human_decision tool
DO NOT CONTINUE UNTIL AFTER THE HUMAN HAS PROVIDED A RESPONSE
DO NOT CONTINUE UNTIL AFTER THE HUMAN HAS PROVIDED A CLARIFICATION RESPONSE
6. list all the repos under this owner: {GITHUB_USERNAME}
7. list files under this repo: {REPO_NAME} for owner: {GITHUB_USERNAME} at the root of the repo
8. from those list of files, select the one that is best associated with the error using the owner: {GITHUB_USERNAME} and repo: {REPO_NAME}.
9. view the contents of the selected file using the owner and repo information from before. Use the Use the repo: {REPO_NAME} and owner: {GITHUB_USERNAME}
10. based on the human input, you should do either of the following:
if the human stated ISSUE, create an ISSUE like a bug report, stating the errors found in the logs. Use the repo: {REPO_NAME} and owner: {GITHUB_USERNAME}. you decide the title and body appropriately of the issue
if the human stated PR:
commit a change to the selected file on the head branch called bug-fix, and base branch as main, with your proposed fix of the error given the contents of the selected file. you appropriately decide on the body and title of the PR. Use the repo: {REPO_NAME} and owner: {GITHUB_USERNAME}
""".format(GITHUB_USERNAME=GITHUB_USERNAME, REPO_NAME=REPO_NAME)
8. from those list of files, select the file that is best associated with the file for which the error is in error using the owner: {GITHUB_USERNAME} and repo: {REPO_NAME}. Select the file by name as you dedeuce from the error, not by some arbitrary path which doesn't exist.
9. read the selected file's contents. Use the Use the repo: {REPO_NAME} and owner: {GITHUB_USERNAME}
10. based on the human clarification resolution, you should do either create a PR if the human said PR or create an ISSUE if the human said ISSUE
if the human said PR do the following (ONLY DO THESE IF PR):
- generate a fix taking into account the errors and the selected file content.
- Then commit this fix to the selected file in the repo: {REPO_NAME} using github_add_commit_file tool; this commit should be on branch: {HEAD_BRANCH} as the feature branch with base_branch as {BASE_BRANCH}.
- Then createa a github pull request from the feature branch {HEAD_BRANCH} using the create_github_pull_request tool; you appropriately decide on the body and title of the PR. Use the repo: {REPO_NAME} head_branch={HEAD_BRANCH}, and base_branch={BASE_BRANCH}.

else if the human said ISSUE, create an ISSUE like a bug report, stating the errors found in the logs. Use the repo: {REPO_NAME} and owner: {GITHUB_USERNAME}. you decide the title and body appropriately of the issue
""".format(GITHUB_USERNAME=GITHUB_USERNAME, REPO_NAME=REPO_NAME, BASE_BRANCH=BASE_BRANCH, HEAD_BRANCH=HEAD_BRANCH)

plan = portia.plan(query)

Expand All @@ -119,9 +123,7 @@ def run_plan(plan_id: str):
plan = my_store.get_plan(plan_id)

run = portia.run_plan(plan)
# print(run.model_dump_json(indent=2))

# return run.model_dump_json(indent=2)
return run.outputs.clarifications[0]


Expand All @@ -133,14 +135,12 @@ def resume_run(plan_run_id:str, user_input:str):
plan_run = my_store.get_plan_run(plan_run_id)
plan = my_store.get_plan(plan_run.plan_id)

# resumed_plan_run = portia.resume(plan_run, plan_run_id)

while plan_run.state == PlanRunState.NEED_CLARIFICATION:
for clarification in plan_run.get_outstanding_clarifications():
plan_run = portia.resolve_clarification(clarification, user_input, plan_run)

plan_run = portia.resume(plan_run, plan_run.id)
# portia.run

return plan_run

Expand All @@ -153,6 +153,6 @@ def resume_run(plan_run_id:str, user_input:str):

plan_run_id = plan_start.plan_run_id

resumed_run = resume_run(plan_run_id, "ISSUE")
resumed_run = resume_run(plan_run_id, "PR")
print("\n RESUMED RUN")
print(resumed_run)
7 changes: 0 additions & 7 deletions backend/app/repos.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,6 @@ class UserEmailRequest(BaseModel):
user_email: str


class CreateSwitchRequest(BaseModel):
user_email: str
name: str
content: str
interval: int


class AddRepoRequest(BaseModel):
username: str
id: str
Expand Down
106 changes: 0 additions & 106 deletions backend/app/tasks.py

This file was deleted.

Binary file removed backend/celerybeat-schedule
Binary file not shown.
6 changes: 0 additions & 6 deletions backend/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
fastapi[standard]
fastapi-mail
sqlmodel
sqlalchemy
uvicorn[standard]
Expand All @@ -9,11 +8,6 @@ python-jose
pydantic
bcrypt==3.2.0
alembic
celery
redis
flower
celery[redis]
sqlalchemy-celery-beat
dotenv
portia-sdk-python
boto3
Expand Down
28 changes: 0 additions & 28 deletions frontend/src/components/generic/SummaryCard.astro

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/browserslist

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/esbuild

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/jsesc

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/json5

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/loose-envify

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/nanoid

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/parser

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/resolve

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/rollup

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/semver

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/update-browserslist-db

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/vite

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/yaml

This file was deleted.

Loading
Loading