Skip to content

Commit aea8058

Browse files
committed
fix(review-feedback-1224): address latest review comments
1 parent 43f3eab commit aea8058

2 files changed

Lines changed: 19 additions & 14 deletions

File tree

docs/CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
1515
- [改进] 放宽 LiteLLM 依赖约束,保留 `>=1.80.10` 最低版本并显式排除 PyPI 事故版本 `1.82.7` / `1.82.8`,允许安装后续 1.x 修复版本。
1616
- [改进] 补齐通知渠道 P0 基线、Actions 映射与 `--check-notify` 只读诊断,完善 AstrBot 配置入口和通知回归快照。
1717
- [修复] 修正 LLM 渠道测试中 `Model disabled` 被误报为网络异常的问题,并在失败提示中展示本次实际测试模型。
18-
- [修复] 修正 LLM 渠道测试中 `Your request was blocked` 等上游拦截错误被误报为网络异常的问题。
19-
- [测试] 补充 LLM 渠道连接测试与模型发现失败分流的回归用例(含 `request_blocked/provider_blocked``model_access_denied``quota``network_error` 的边界),覆盖 `Your request was blocked``request has been blocked by policy` 等上游拦截信号。
2018
- [chore] 清理仓库根目录:移除误入库的 `.codex``review.md` 跟踪记录,将 smoke 测试入口迁移到 `scripts/`、环境检查脚本迁移为 `scripts/check_env.py`,并将 LiteLLM YAML 示例迁移到 `docs/examples/`
2119
- [新功能] Web 设置页新增通知渠道一键测试,支持临时配置、耗时与脱敏 attempts 展示。
20+
- [修复] 修正 LLM 渠道测试中 `Your request was blocked` 等上游拦截错误被误报为网络异常的问题;新增阻断分类仅为诊断信号,不触发用户配置迁移或清理。
21+
- [测试] 补充 LLM 渠道连接测试与模型发现失败分流的回归用例(含 `request_blocked/provider_blocked``model_access_denied``quota``network_error` 的边界),覆盖 `Your request was blocked``request has been blocked by policy` 等上游拦截信号,兼容性验证覆盖 `litellm.completion``/models` 两条执行路径。
2222

2323
## [3.15.0] - 2026-05-05
2424

src/services/system_config_service.py

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,17 @@ class SystemConfigService:
8787

8888
_LLM_CAPABILITY_ORDER: Tuple[str, ...] = ("json", "tools", "stream", "vision")
8989
_LLM_STREAM_CHUNK_LIMIT = 8
90+
_LLM_PROVIDER_BLOCKED_TOKENS: Tuple[str, ...] = (
91+
"your request was blocked",
92+
"request was blocked",
93+
"request has been blocked",
94+
"request is blocked",
95+
"request blocked",
96+
"blocked by safety",
97+
"blocked by policy",
98+
"blocked by content",
99+
"moderation_blocked",
100+
)
90101
_LLM_CAPABILITY_PROBE_IMAGE = (
91102
"data:image/png;base64,"
92103
"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+/p9sAAAAASUVORK5CYII="
@@ -2665,19 +2676,13 @@ def _has_model_access_denied_signal(text: str) -> bool:
26652676

26662677
@staticmethod
26672678
def _has_provider_blocked_signal(text: str) -> bool:
2679+
"""Match known upstream provider/gateway blocked signals for diagnostic classification.
2680+
2681+
These markers are only used to surface a dedicated `request_blocked` reason
2682+
in runtime checks and do not mutate or migrate persisted user config.
2683+
"""
26682684
lowered = text.lower()
2669-
blocked_tokens = (
2670-
"your request was blocked",
2671-
"request was blocked",
2672-
"request has been blocked",
2673-
"request is blocked",
2674-
"request blocked",
2675-
"blocked by safety",
2676-
"blocked by policy",
2677-
"blocked by content",
2678-
"moderation_blocked",
2679-
)
2680-
return any(token in lowered for token in blocked_tokens)
2685+
return any(token in lowered for token in SystemConfigService._LLM_PROVIDER_BLOCKED_TOKENS)
26812686

26822687
@staticmethod
26832688
def _has_provider_prefix_mismatch_signal(text: str) -> bool:

0 commit comments

Comments
 (0)