mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-01-22 21:48:12 -05:00
Compare commits
4 Commits
testing-cl
...
abhi/fix-g
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d5b8e2dae0 | ||
|
|
0be6ff45c7 | ||
|
|
c8b17c6d03 | ||
|
|
5a13db8054 |
@@ -2,7 +2,6 @@ import logging
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
import fastapi
|
|
||||||
import prisma.enums
|
import prisma.enums
|
||||||
import prisma.errors
|
import prisma.errors
|
||||||
import prisma.models
|
import prisma.models
|
||||||
@@ -755,7 +754,7 @@ async def get_my_agents(
|
|||||||
|
|
||||||
async def get_agent(
|
async def get_agent(
|
||||||
store_listing_version_id: str, version_id: Optional[int]
|
store_listing_version_id: str, version_id: Optional[int]
|
||||||
) -> GraphModel:
|
) -> Optional[GraphModel]:
|
||||||
"""Get agent using the version ID and store listing version ID."""
|
"""Get agent using the version ID and store listing version ID."""
|
||||||
try:
|
try:
|
||||||
store_listing_version = (
|
store_listing_version = (
|
||||||
@@ -765,28 +764,20 @@ async def get_agent(
|
|||||||
)
|
)
|
||||||
|
|
||||||
if not store_listing_version or not store_listing_version.Agent:
|
if not store_listing_version or not store_listing_version.Agent:
|
||||||
raise fastapi.HTTPException(
|
logger.error(f"Store listing version {store_listing_version_id} not found")
|
||||||
status_code=404,
|
return None
|
||||||
detail=f"Store listing version {store_listing_version_id} not found",
|
|
||||||
)
|
|
||||||
|
|
||||||
graph_id = store_listing_version.agentId
|
graph_id = store_listing_version.agentId
|
||||||
graph_version = store_listing_version.agentVersion
|
graph_version = store_listing_version.agentVersion
|
||||||
graph = await backend.data.graph.get_graph(graph_id, graph_version)
|
graph = await backend.data.graph.get_graph(graph_id, graph_version)
|
||||||
|
|
||||||
if not graph:
|
if not graph:
|
||||||
raise fastapi.HTTPException(
|
logger.error(f"Agent {agent.id} not found")
|
||||||
status_code=404,
|
return None
|
||||||
detail=(
|
|
||||||
f"Agent #{graph_id} not found "
|
|
||||||
f"for store listing version #{store_listing_version_id}"
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
graph.version = 1
|
graph.version = 1
|
||||||
graph.is_template = False
|
graph.is_template = False
|
||||||
graph.is_active = True
|
graph.is_active = True
|
||||||
delattr(graph, "user_id")
|
|
||||||
|
|
||||||
return graph
|
return graph
|
||||||
|
|
||||||
|
|||||||
@@ -616,6 +616,11 @@ async def download_agent_file(
|
|||||||
store_listing_version_id=store_listing_version_id, version_id=version
|
store_listing_version_id=store_listing_version_id, version_id=version
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if not graph_data:
|
||||||
|
raise fastapi.HTTPException(
|
||||||
|
status_code=404, detail=f"Graph with {store_listing_version_id} no found"
|
||||||
|
)
|
||||||
|
|
||||||
graph_data.clean_graph()
|
graph_data.clean_graph()
|
||||||
graph_date_dict = jsonable_encoder(graph_data)
|
graph_date_dict = jsonable_encoder(graph_data)
|
||||||
|
|
||||||
@@ -625,6 +630,8 @@ async def download_agent_file(
|
|||||||
del obj["credentials"]
|
del obj["credentials"]
|
||||||
if "creds" in obj:
|
if "creds" in obj:
|
||||||
del obj["creds"]
|
del obj["creds"]
|
||||||
|
if "user_id" in obj:
|
||||||
|
del obj["user_id"]
|
||||||
|
|
||||||
for value in obj.values():
|
for value in obj.values():
|
||||||
remove_credentials(value)
|
remove_credentials(value)
|
||||||
|
|||||||
Reference in New Issue
Block a user