refactor(api): TOML 配置 SSOT、统一错误契约、Auth/事务加固与可观测性 (#33)

配置 SSOT(TOML + .env)
统一错误契约
Auth 与事务边界
Redis / Celery 可靠性:业务 Redis(DB/0)与 Celery broker/backend(DB/1)显式拆分;连接池、sync client
可观测性(OpenTelemetry + LGTM)
This commit is contained in:
Sully
2026-05-22 13:44:50 +08:00
committed by GitHub
parent f09ae248f9
commit 53e0065e3e
298 changed files with 15247 additions and 4344 deletions

View File

@@ -34,6 +34,7 @@ from app.agents.stage_constants import (
)
from app.agents.state_schema import KnownFact, PersonaThread
from app.core.config import settings
from app.features.conversation.constants import chat
# 风格示例的单一事实源已迁至 `app.agents.style_profiles.ChatStyleProfile.reply_style_examples`
# 这里**不再**维护具体字面示例,避免同一模块被当作 few-shot 锚点反复注入,导致风格过拟合。
@@ -292,7 +293,7 @@ def get_opening_prompt(
era_opening_line = ""
if (
settings.chat_era_context_enabled
chat.era_context_enabled
and profile_birth_year is not None
and _compact_era_hint(
current_stage,
@@ -450,7 +451,7 @@ def get_guided_conversation_prompt(
)
era_line = ""
if settings.chat_era_context_enabled:
if chat.era_context_enabled:
era_line = _compact_era_hint(
active_stage,
birth_year=profile_birth_year,
@@ -696,7 +697,7 @@ _STAGE_TOPIC_CHIP_BANK: Dict[str, List[tuple[str, str]]] = {
("support", "家人之间的相互支持"),
("responsibility", "肩上的家庭责任"),
],
"later_life": [
"belief": [
("value", "现在最看重的事"),
("regret", "心里的遗憾"),
("pride", "最骄傲的事"),