feat(agents): 内置智能体筛选(仅管理员)+ 内置 agent 默认用途标签
- 后端 scope=builtin(user_id IS NULL)加入 sql/memory 的 scope 过滤; /api/agents 扩展 scope 正则并加 admin 闸门(非管理员请求 403) - 新增 _builtin_agent_tag_seed:启动时幂等给功能型内置 agent 按用途打标签 (roundtable-* → 多智能体规划,ai-writing-* → AI写作),只追加不覆盖; 无用途的内置 agent 不打标签 - 前端 agent-gallery 新增「内置智能体」Tab(仅 system_role==admin 可见), scope 类型在 api.ts/hooks.ts 同步 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
391409b6c0
commit
cd3a71baab
8 files changed
+163
-9
No files matched your search
@@ -980,6 +980,18 @@ async def lifespan(app: FastAPI) -> AsyncGenerator[None, None]:
|
||||
# re-run the heavy sync even though we just did it.
|
||||
_services_mark_sync_fresh()
|
||||
logger.info("Legacy folder-backed agents synced at startup")
|
||||
# 内置功能型 agent(roundtable-* / ai-writing-*)按用途默认打标签,
|
||||
# 供管理员「内置智能体」筛选按用途归类。幂等、只追加、失败不阻塞启动。
|
||||
try:
|
||||
from app.gateway.routers._builtin_agent_tag_seed import (
|
||||
ensure_builtin_agent_purpose_tags,
|
||||
)
|
||||
|
||||
tag_store = getattr(app.state, "tag_store", None)
|
||||
if tag_store is not None:
|
||||
await ensure_builtin_agent_purpose_tags(agent_store, tag_store)
|
||||
except Exception:
|
||||
logger.exception("Built-in agent purpose-tag seeding failed at startup (non-fatal)")
|
||||
except Exception:
|
||||
logger.exception("Legacy agent sync failed at startup (non-fatal)")
|
||||
|
||||
|
||||
Reference in new issue
Block a user