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:
@@ -42,12 +42,8 @@ class TokenData(BaseModel):
|
||||
|
||||
|
||||
def _get_secret_key() -> str:
|
||||
"""读取并校验 SECRET_KEY 环境变量。
|
||||
|
||||
校验在首次实际使用 JWT 时进行,避免在模块导入阶段抛错,
|
||||
从而把"环境约束"和"模块加载"解耦。
|
||||
"""
|
||||
key = os.getenv("SECRET_KEY")
|
||||
from kilostar.utils.settings import get_settings
|
||||
key = get_settings().security.secret_key
|
||||
if not key or key in _INSECURE_SECRETS:
|
||||
raise RuntimeError(
|
||||
"未提供有效的 SECRET_KEY 或使用了不安全的默认值,请设置一个高熵的随机字符串"
|
||||
|
||||
Reference in New Issue
Block a user