chore/ 精简展示AI活动的日志

This commit is contained in:
Kevin
2026-04-03 13:49:24 +08:00
parent 43d1689e9c
commit 4cfa3843a7
11 changed files with 194 additions and 24 deletions

View File

@@ -188,6 +188,14 @@ class Settings(BaseSettings):
log_agent_verbose: bool = False
# AGENT_LOG_MAX_CHARSDEBUG 下记录 prompt/响应预览时的最大字符数
agent_log_max_chars: int = Field(default=4096, ge=256, le=100_000)
# AGENT_LOG_OMIT_SYSTEM_MESSAGE_BODYDEBUG 下访谈/资料聊天日志省略 System 正文(仅 len+sha12
agent_log_omit_system_message_body: bool = True
# AGENT_LOG_JSON_PROMPT_PREFIX_CHARSDEBUG 下 *.prompt 总长超过下项时再跳过前 N 字符后预览0=不跳过)
agent_log_json_prompt_prefix_chars: int = Field(default=0, ge=0, le=500_000)
# AGENT_LOG_JSON_PROMPT_PREFIX_ONLY_IF_LEN_GT触发“跳过前缀”的最小 prompt 长度
agent_log_json_prompt_prefix_only_if_len_gt: int = Field(
default=4000, ge=0, le=2_000_000
)
# 第三方 stdlib logging空=自动LOG_LEVEL 为 DEBUG/TRACE 时 Celery→INFO、httpx/httpcore→WARNING
celery_log_level: str = ""
httpx_log_level: str = ""
@@ -201,6 +209,18 @@ class Settings(BaseSettings):
return False
return str(v).strip().lower() in ("1", "true", "yes", "on")
@field_validator("agent_log_omit_system_message_body", mode="before")
@classmethod
def _coerce_agent_log_omit_system_message_body(cls, v: object) -> bool:
if isinstance(v, bool):
return v
if v is None:
return True
s = str(v).strip().lower()
if s in ("0", "false", "no", "off"):
return False
return True
# ── Misc ─────────────────────────────────────────────────
enable_test_subscription: int = 0
enable_test_plan: str = "" # "1" / "true" / "yes" 为 True