Files
Pine 980a2db6d9 refactor: 平台应用异步四层架构(接口/业务/领域/基础设施)
- 基础设施层 async:SQLAlchemy 异步引擎/会话、33 Repository async 化、models/security/seed 迁入 infrastructure、新增 cache.py(redis.asyncio) 与 oss.py(aioboto3)
- 接口层:routers 迁 api/routers 并全 async,dependencies 迁 api/dependencies(get_db/get_current_user async)
- 依赖:sqlalchemy[asyncio]/aiosqlite/asyncmy/redis/aioboto3;config 异步 URL + Redis/OSS 配置
- 删除废弃:旧同步 db/dependencies/repositories/storage
- 验证:平台 19 路由 + 培训 48 路由全注册;/health /auth/login /auth/me /admin/tasks /notifications 等接口 async 可用
2026-08-23 23:52:58 +08:00

33 lines
1.2 KiB
Python

# -*- coding: utf-8 -*-
"""智能体引导(bootstrap)路由。
返回"所有用户首次启动都必须初始化的智能体"定义 —— 由服务端统一控制。
这是全局定义(对所有用户相同),因此**公开**(无需登录),本地据此在首次启动时
初始化本地 workspace,避免本地硬编码默认智能体。
"""
from __future__ import annotations
from fastapi import APIRouter
from ...infrastructure.repositories import AGENT_SEED
router = APIRouter(tags=["bootstrap"])
@router.get("/agent-bootstrap", summary="必初始化智能体定义")
async def agent_bootstrap():
"""返回服务端定义的必初始化智能体(id/name/desc/lang/template_type/deletable)。"""
return [
{
"id": seed["id"],
"name": seed["name"],
"description": seed.get("description", ""),
"language": seed.get("language", "zh"),
"model_name": seed.get("model_name", ""),
"template_type": seed.get("template_type", "default"),
"deletable": seed.get("deletable", True),
"use_fixed_soul": seed.get("use_fixed_soul", False),
}
for seed in AGENT_SEED
]