Files
server-core/app/api/routers/bootstrap.py
T

33 lines
1.2 KiB
Python
Raw Normal View History

# -*- 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
]