feat: 人设模板系统、节点调度标签、pydantic-settings收敛、错误处理增强
新增persona_template表和CRUD API,BaseIndividualModel增加node_affinity和template_origin_id字段, WorkerCluster支持多集群Ray资源调度,环境变量收敛到pydantic-settings统一校验, 数据库异常转换为结构化BusinessError/RetryableError,系统节点支持custom_system_prompt。 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -21,6 +21,7 @@ from fastapi.responses import FileResponse, JSONResponse
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
|
||||
from kilostar.utils.standalone_proxy import _STANDALONE
|
||||
from kilostar.utils.settings import get_settings
|
||||
|
||||
if not _STANDALONE:
|
||||
from ray import serve
|
||||
@@ -51,13 +52,13 @@ _api_logger = get_logger("api")
|
||||
|
||||
|
||||
def _get_locale(request: Request) -> str | None:
|
||||
"""从请求头解析首选语言,供异常 handler 使用。"""
|
||||
return request.headers.get("accept-language") or None
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
_cors_origins_env = os.environ.get("KILOSTAR_CORS_ORIGINS", "")
|
||||
_is_dev = os.environ.get("KILOSTAR_ENV", "production").lower() in ("dev", "development")
|
||||
_settings = get_settings()
|
||||
_cors_origins_env = _settings.kilostar_cors_origins
|
||||
_is_dev = _settings.security.kilostar_env.lower() in ("dev", "development")
|
||||
if not _cors_origins_env and _is_dev:
|
||||
_cors_origins_env = "*"
|
||||
elif not _cors_origins_env:
|
||||
|
||||
Reference in New Issue
Block a user