Skip to content

Commit

Permalink
fix:lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhi1992002 committed Dec 23, 2024
1 parent c856907 commit bb251ae
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 14 deletions.
7 changes: 5 additions & 2 deletions autogpt_platform/backend/backend/server/v2/store/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,10 @@ async def get_my_agents(
"Failed to fetch my agents"
) from e

async def get_agent(store_listing_version_id: str, version_id:Optional[int]) -> GraphModel:

async def get_agent(
store_listing_version_id: str, version_id: Optional[int]
) -> GraphModel:
"""Get agent using the version ID and store listing version ID."""
try:
store_listing_version = (
Expand Down Expand Up @@ -810,7 +813,7 @@ async def get_agent(store_listing_version_id: str, version_id:Optional[int]) ->
graph.version = 1
graph.is_template = False
graph.is_active = True
delattr(graph, 'user_id')
delattr(graph, "user_id")

return graph

Expand Down
22 changes: 14 additions & 8 deletions autogpt_platform/backend/backend/server/v2/store/routes.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
import json
import logging
import tempfile
import typing
import urllib.parse
import tempfile
import json


import autogpt_libs.auth.depends
import autogpt_libs.auth.middleware
import fastapi
import fastapi.responses
from fastapi.encoders import jsonable_encoder

import backend.data.graph
import backend.server.v2.store.db
import backend.server.v2.store.image_gen
import backend.server.v2.store.media
import backend.server.v2.store.model
from fastapi.encoders import jsonable_encoder


logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -514,9 +512,15 @@ async def generate_image(
status_code=500, detail=f"Failed to generate image: {str(e)}"
)

@router.get("/download/agents/{store_listing_version_id}",tags=["store","public"],)

@router.get(
"/download/agents/{store_listing_version_id}",
tags=["store", "public"],
)
async def download_agent_file(
store_listing_version_id: str = fastapi.Path(..., description="The ID of the agent to download"),
store_listing_version_id: str = fastapi.Path(
..., description="The ID of the agent to download"
),
version: typing.Optional[int] = fastapi.Query(
None, description="Specific version of the agent"
),
Expand All @@ -535,7 +539,9 @@ async def download_agent_file(
HTTPException: If the agent is not found or an unexpected error occurs.
"""

graph_data = await backend.server.v2.store.db.get_agent(store_listing_version_id=store_listing_version_id, version_id=version)
graph_data = await backend.server.v2.store.db.get_agent(
store_listing_version_id=store_listing_version_id, version_id=version
)

graph_date_dict = jsonable_encoder(graph_data)

Expand Down
2 changes: 1 addition & 1 deletion autogpt_platform/backend/backend/util/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class Config(UpdateTrackingModel["Config"], BaseSettings):
)

media_gcs_bucket_name: str = Field(
default="",
default="autogpt_bucket",
description="The name of the Google Cloud Storage bucket for media files",
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,9 +352,11 @@ export default class BackendAPI {
storeListingVersionId: string,
version?: number,
): Promise<BlobPart> {
return this._get(
`/download/agents/${storeListingVersionId}?version=${version}`,
);
const url = version
? `/store/download/agents/${storeListingVersionId}?version=${version}`
: `/store/download/agents/${storeListingVersionId}`;

return this._get(url);
}

/////////////////////////////////////////
Expand Down

0 comments on commit bb251ae

Please sign in to comment.