Skip to content

Commit

Permalink
Merge branch 'main' into feature/vault
Browse files Browse the repository at this point in the history
  • Loading branch information
aybruhm committed Dec 6, 2024
2 parents a2b0471 + 73335ee commit 3ec6adb
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
7 changes: 7 additions & 0 deletions agenta-backend/agenta_backend/routers/projects_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,17 @@


class ProjectsResponse(BaseModel):
organization_id: Optional[UUID] = None
organization_name: Optional[str] = None
# is_default_organization: Optional[bool] = None
workspace_id: Optional[UUID] = None
workspace_name: Optional[str] = None
# is_default_workspace: Optional[bool] = None
project_id: UUID
project_name: str
# is_default_project: bool
user_role: Optional[str] = None
is_demo: Optional[bool] = None


router = APIRouter()
Expand Down Expand Up @@ -64,11 +68,14 @@ async def get_projects(

projects = [
ProjectsResponse(
organization_id=project_membership.project.organization.id,
organization_name=project_membership.project.organization.name,
workspace_id=project_membership.project.workspace.id,
workspace_name=project_membership.project.workspace.name,
project_id=project_membership.project.id,
project_name=project_membership.project.project_name,
user_role=project_membership.role,
is_demo=project_membership.is_demo,
)
for project_membership in _project_memberships
]
Expand Down
2 changes: 1 addition & 1 deletion agenta-cli/agenta/sdk/decorators/routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ def handle_failure(self, error: Exception):
log.warning(format_exc().strip("\n"))
log.warning("--------------------------------------------------")

status_code = error.status_code if hasattr(error, "status_code") else 500
status_code = 500
message = str(error)
stacktrace = format_exception(error, value=error, tb=error.__traceback__) # type: ignore
detail = {"message": message, "stacktrace": stacktrace}
Expand Down
20 changes: 16 additions & 4 deletions agenta-web/src/services/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,11 @@ export async function callVariant(
return response
})
.catch(async (error) => {
console.log("Unsecure call to LLM App failed:", error?.status)
console.log("Unsecure call to LLM App failed:", error)

if (error?.response?.status !== 401) {
throw error
}

let response = await axios
.post(secure_url, requestBody, {
Expand All @@ -163,7 +167,9 @@ export async function callVariant(
return response
})
.catch((error) => {
console.log("Secure call to LLM App failed:", error?.status)
console.log("Secure call to LLM App failed:", error)

throw error
})

return response
Expand Down Expand Up @@ -200,7 +206,11 @@ export const fetchVariantParametersFromOpenAPI = async (
return response
})
.catch(async (error) => {
console.log("Unsecure call to LLM App failed:", error?.status)
console.log("Unsecure call to LLM App failed:", error)

if (error?.response?.status !== 401) {
throw error
}

let response = await axios
.get(secure_url, {
Expand All @@ -211,7 +221,9 @@ export const fetchVariantParametersFromOpenAPI = async (
return response
})
.catch((error) => {
console.log("Secure call to LLM App failed:", error?.status)
console.log("Secure call to LLM App failed:", error)

throw error
})

return response
Expand Down

0 comments on commit 3ec6adb

Please sign in to comment.