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:
2026-06-04 06:07:46 +00:00
parent f3a92a793e
commit 8f1398c591
23 changed files with 582 additions and 48 deletions
+6 -5
View File
@@ -5,7 +5,7 @@ from pydantic import BaseModel, ValidationError
from sqlalchemy.exc import IntegrityError, OperationalError
from kilostar.core.postgres_database.database_exception import database_exception
from kilostar.utils.error import UserNotExistError
from kilostar.utils.error import UserNotExistError, BusinessError, RetryableError
async def test_normal_path_returns_value():
@@ -36,21 +36,22 @@ async def test_validation_error_propagates():
await boom()
async def test_integrity_error_propagates():
async def test_integrity_error_becomes_business_error():
@database_exception
async def boom() -> None:
raise IntegrityError("stmt", {}, Exception("dup"))
with pytest.raises(IntegrityError):
with pytest.raises(BusinessError) as exc_info:
await boom()
assert exc_info.value.http_status == 409
async def test_operational_error_propagates():
async def test_operational_error_becomes_retryable():
@database_exception
async def boom() -> None:
raise OperationalError("stmt", {}, Exception("conn"))
with pytest.raises(OperationalError):
with pytest.raises(RetryableError):
await boom()