fix: 智能体可见性对齐——列表可见即可打开问答,消除 404
get_visible 此前比列表过滤更严格(仅 内置/本人/已发布),导致私密广场 智能体(转私密强制 published=false)和「我的」里已收藏但被取消发布的 智能体能在列表看到、点开问答却 404(前端连带报 X.map is not a function)。 - AgentRepository._visible_filter / MemoryAgentStore._is_fetchable: 单条读取放宽为所有列表口径的并集(+is_private 豁免、+本人收藏豁免) - 详情接口与 _enforce_agent_access 运行门禁:管理员回退 get_any, 对齐 ?admin=true 全量列表 - 普通未发布草稿对陌生人仍不可见,隐私不放开 - 本地新增 tests/test_agent_visibility.py 覆盖 SQL/Memory 双实现 (tests/ 目录在本仓库被 gitignore,不随提交) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0b98d18483
commit
e7b51a30a3
5 files changed
+45
-9
No files matched your search
@@ -723,6 +723,10 @@ async def get_agent(agent_id: str, request: Request) -> AgentResponse:
|
||||
await _maybe_sync_legacy_agents(store)
|
||||
user_id = _current_user_id(request)
|
||||
record = await store.get_visible(agent_id, user_id)
|
||||
if record is None and _is_admin_user(request):
|
||||
# The admin console lists every agent (?admin=true), so an admin
|
||||
# must be able to open any of them — mirror that here.
|
||||
record = await store.get_any(agent_id)
|
||||
if record is None:
|
||||
raise HTTPException(status_code=404, detail=f"Agent '{agent_id}' not found")
|
||||
# Detail view legitimately reads SOUL.md + config.yaml — hop to a
|
||||
|
||||
Reference in new issue
Block a user