mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-01-12 00:28:31 -05:00
Compare commits
1 Commits
dev
...
seer/feat/
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
944e34f319 |
@@ -1170,6 +1170,27 @@ async def set_execution_kv_data(
|
||||
return type_utils.convert(resp.data, type[Any]) if resp and resp.data else None
|
||||
|
||||
|
||||
async def get_graph_execution_by_share_token(
|
||||
share_token: str,
|
||||
) -> GraphExecutionWithNodes | None:
|
||||
"""Get graph execution by share token for public sharing endpoints."""
|
||||
# Note: This is a reconstructed function based on the error context
|
||||
# The actual implementation may need to be adapted based on the sharing mechanism
|
||||
|
||||
# For now, we'll search by the share_token as if it were an execution ID
|
||||
# This should be updated to match the actual sharing token schema
|
||||
execution = await AgentGraphExecution.prisma().find_first(
|
||||
where={"id": share_token, "isDeleted": False},
|
||||
include=GRAPH_EXECUTION_INCLUDE_WITH_NODES,
|
||||
)
|
||||
|
||||
if not execution:
|
||||
return None
|
||||
|
||||
# Use the existing from_db method to ensure consistency with other parts of the codebase
|
||||
return GraphExecutionWithNodes.from_db(execution)
|
||||
|
||||
|
||||
async def get_block_error_stats(
|
||||
start_time: datetime, end_time: datetime
|
||||
) -> list[BlockErrorStats]:
|
||||
|
||||
@@ -667,6 +667,22 @@ async def create_new_graph(
|
||||
return await on_graph_activate(graph, user_id=user_id)
|
||||
|
||||
|
||||
@v1_router.get(
|
||||
path="/public/shared/{share_token}",
|
||||
summary="Get shared execution by token",
|
||||
tags=["executions", "public"],
|
||||
dependencies=[], # No authentication required for public endpoints
|
||||
)
|
||||
async def get_shared_execution(
|
||||
share_token: str = Path(..., description="The share token for the execution"),
|
||||
) -> execution_db.GraphExecutionWithNodes:
|
||||
"""Get a shared execution by its share token."""
|
||||
execution = await execution_db.get_graph_execution_by_share_token(share_token)
|
||||
if not execution:
|
||||
raise HTTPException(status_code=404, detail="Shared execution not found")
|
||||
return execution
|
||||
|
||||
|
||||
@v1_router.delete(
|
||||
path="/graphs/{graph_id}",
|
||||
summary="Delete graph permanently",
|
||||
@@ -942,6 +958,22 @@ async def get_graph_execution(
|
||||
return result
|
||||
|
||||
|
||||
@v1_router.get(
|
||||
path="/public/shared/{share_token}",
|
||||
summary="Get shared execution by token",
|
||||
tags=["executions", "public"],
|
||||
dependencies=[], # No authentication required for public endpoints
|
||||
)
|
||||
async def get_shared_execution(
|
||||
share_token: str = Path(..., description="The share token for the execution"),
|
||||
) -> execution_db.GraphExecutionWithNodes:
|
||||
"""Get a shared execution by its share token."""
|
||||
execution = await execution_db.get_graph_execution_by_share_token(share_token)
|
||||
if not execution:
|
||||
raise HTTPException(status_code=404, detail="Shared execution not found")
|
||||
return execution
|
||||
|
||||
|
||||
@v1_router.delete(
|
||||
path="/executions/{graph_exec_id}",
|
||||
summary="Delete graph execution",
|
||||
@@ -1052,6 +1084,22 @@ async def list_all_graphs_execution_schedules(
|
||||
return await get_scheduler_client().get_execution_schedules(user_id=user_id)
|
||||
|
||||
|
||||
@v1_router.get(
|
||||
path="/public/shared/{share_token}",
|
||||
summary="Get shared execution by token",
|
||||
tags=["executions", "public"],
|
||||
dependencies=[], # No authentication required for public endpoints
|
||||
)
|
||||
async def get_shared_execution(
|
||||
share_token: str = Path(..., description="The share token for the execution"),
|
||||
) -> execution_db.GraphExecutionWithNodes:
|
||||
"""Get a shared execution by its share token."""
|
||||
execution = await execution_db.get_graph_execution_by_share_token(share_token)
|
||||
if not execution:
|
||||
raise HTTPException(status_code=404, detail="Shared execution not found")
|
||||
return execution
|
||||
|
||||
|
||||
@v1_router.delete(
|
||||
path="/schedules/{schedule_id}",
|
||||
summary="Delete execution schedule",
|
||||
@@ -1125,6 +1173,22 @@ async def get_api_key(
|
||||
return api_key
|
||||
|
||||
|
||||
@v1_router.get(
|
||||
path="/public/shared/{share_token}",
|
||||
summary="Get shared execution by token",
|
||||
tags=["executions", "public"],
|
||||
dependencies=[], # No authentication required for public endpoints
|
||||
)
|
||||
async def get_shared_execution(
|
||||
share_token: str = Path(..., description="The share token for the execution"),
|
||||
) -> execution_db.GraphExecutionWithNodes:
|
||||
"""Get a shared execution by its share token."""
|
||||
execution = await execution_db.get_graph_execution_by_share_token(share_token)
|
||||
if not execution:
|
||||
raise HTTPException(status_code=404, detail="Shared execution not found")
|
||||
return execution
|
||||
|
||||
|
||||
@v1_router.delete(
|
||||
"/api-keys/{key_id}",
|
||||
summary="Revoke API key",
|
||||
|
||||
Reference in New Issue
Block a user