mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
fix: remove type: ignore with proper guard clause in _enrich_agents_with_graph
Narrow agent.graph_id from str | None to str with an early return, eliminating the type: ignore[arg-type] suppressor.
This commit is contained in:
@@ -215,13 +215,16 @@ async def _enrich_agents_with_graph(agents: list[AgentInfo], user_id: str) -> No
|
||||
return
|
||||
|
||||
async def _fetch(agent: AgentInfo) -> None:
|
||||
graph_id = agent.graph_id
|
||||
if not graph_id:
|
||||
return
|
||||
try:
|
||||
graph_json = await get_agent_as_json(agent.graph_id, user_id) # type: ignore[arg-type]
|
||||
graph_json = await get_agent_as_json(graph_id, user_id)
|
||||
if graph_json is None:
|
||||
logger.warning(f"Graph not found for agent {agent.graph_id}")
|
||||
logger.warning(f"Graph not found for agent {graph_id}")
|
||||
agent.graph = graph_json
|
||||
except Exception as e:
|
||||
logger.warning(f"Failed to fetch graph for agent {agent.graph_id}: {e}")
|
||||
logger.warning(f"Failed to fetch graph for agent {graph_id}: {e}")
|
||||
|
||||
await asyncio.gather(*[_fetch(a) for a in fetchable])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user