mirror of
https://github.com/Pythagora-io/gpt-pilot.git
synced 2026-01-10 13:37:55 -05:00
Merge branch 'phase_3' of https://github.com/Pythagora-io/pythagora-v1 into phase_3
This commit is contained in:
@@ -69,9 +69,9 @@ async def run_project(sm: StateManager, ui: UIBase, args) -> bool:
|
||||
telemetry.set("end_result", "failure:api-error")
|
||||
await sm.rollback()
|
||||
except CustomAssertionError as err:
|
||||
log.warning(f"Anthropic assertion error occurred: {err.message}")
|
||||
log.warning(f"Anthropic assertion error occurred: {str(err)}")
|
||||
await ui.send_message(
|
||||
f"Stopping Pythagora due to an error inside Anthropic SDK. {err.message}",
|
||||
f"Stopping Pythagora due to an error inside Anthropic SDK. {str(err)}",
|
||||
source=pythagora_source,
|
||||
)
|
||||
telemetry.set("end_result", "failure:assertion-error")
|
||||
|
||||
@@ -40,5 +40,4 @@ class File(Base):
|
||||
content_id=self.content_id,
|
||||
path=self.path,
|
||||
meta=self.meta,
|
||||
content=self.content,
|
||||
)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from copy import deepcopy
|
||||
from datetime import datetime
|
||||
from typing import TYPE_CHECKING, Optional
|
||||
from typing import TYPE_CHECKING, Optional, Union
|
||||
from uuid import UUID, uuid4
|
||||
|
||||
from sqlalchemy import ForeignKey, UniqueConstraint, delete, inspect
|
||||
@@ -377,7 +377,7 @@ class ProjectState(Base):
|
||||
|
||||
return None
|
||||
|
||||
def get_file_content_by_path(self, path: str) -> FileContent | str:
|
||||
def get_file_content_by_path(self, path: str) -> Union[FileContent, str]:
|
||||
"""
|
||||
Get a file from the current project state, by the file path.
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ from contextlib import asynccontextmanager
|
||||
from typing import TYPE_CHECKING, Optional
|
||||
from uuid import UUID, uuid4
|
||||
|
||||
from sqlalchemy import inspect, select
|
||||
from tenacity import retry, stop_after_attempt, wait_fixed
|
||||
|
||||
from core.config import FileSystemType, get_config
|
||||
@@ -619,7 +620,7 @@ class StateManager:
|
||||
async def update_implemented_pages_and_apis(self):
|
||||
modified = False
|
||||
pages = self.get_implemented_pages()
|
||||
apis = self.get_apis()
|
||||
apis = await self.get_apis()
|
||||
|
||||
# Get the current state of pages and apis from knowledge_base
|
||||
current_pages = self.next_state.knowledge_base.get("pages", None)
|
||||
@@ -631,7 +632,7 @@ class StateManager:
|
||||
|
||||
if modified:
|
||||
# TODO - TEMPORARY - remove this
|
||||
self.ui.send_message(
|
||||
await self.ui.send_message(
|
||||
"Updating implemented pages and APIs:\n" + json.dumps(self.next_state.knowledge_base, indent=2)
|
||||
)
|
||||
self.next_state.knowledge_base["pages"] = pages
|
||||
@@ -666,7 +667,7 @@ class StateManager:
|
||||
self.next_state.flag_knowledge_base_as_modified()
|
||||
await self.ui.knowledge_base_update(self.next_state.knowledge_base)
|
||||
|
||||
def get_apis(self) -> list[dict]:
|
||||
async def get_apis(self) -> list[dict]:
|
||||
"""
|
||||
Get the list of APIs.
|
||||
|
||||
@@ -676,7 +677,10 @@ class StateManager:
|
||||
for file in self.next_state.files:
|
||||
if "client/src/api" not in file.path:
|
||||
continue
|
||||
content = file.content.content
|
||||
session = inspect(file).async_session
|
||||
result = await session.execute(select(FileContent).where(FileContent.id == file.content_id))
|
||||
file_content = result.scalar_one_or_none()
|
||||
content = file_content.content
|
||||
lines = content.splitlines()
|
||||
for i, line in enumerate(lines):
|
||||
if "Description:" in line:
|
||||
@@ -720,7 +724,7 @@ class StateManager:
|
||||
Update the list of APIs.
|
||||
|
||||
"""
|
||||
apis = self.get_apis()
|
||||
apis = await self.get_apis()
|
||||
for file in files_with_implemented_apis:
|
||||
for endpoint in file["related_api_endpoints"]:
|
||||
api = next((api for api in apis if (endpoint in api["endpoint"])), None)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "pythagora-core"
|
||||
version = "1.1.7"
|
||||
version = "1.1.9"
|
||||
description = "Build complete apps using AI agents"
|
||||
authors = ["Leon Ostrez <leon@pythagora.ai>"]
|
||||
license = "FSL-1.1-MIT"
|
||||
|
||||
Reference in New Issue
Block a user