Skip to content

fix: skip optional Anthropic model discovery on 404 and 405 - #3

Merged
timmy1688 merged 1 commit into
dromara:mainfrom
LiuS1mple:codex/optional-anthropic-model-discovery
Nov 5, 2026
Merged

timmy1688 merged 1 commit into
dromara:mainfrom
LiuS1mple:codex/optional-anthropic-model-discovery

Conversation

@LiuS1mple

Copy link
Copy Markdown
Contributor

What changes

DeepSeek 等 Anthropic 兼容端点可能提供正常的 /v1/messages,但没有 /v1/models。原检测会将模型列表的 404 算作失败,导致 Messages 和 Messages 流式都通过时,顶层 success 仍为 false。

现在只对 Anthropic 渠道的 models 检查实际返回 HTTP 404 / 405 增加可选检查语义:

  • 返回 status=skipped、skip_reason=models_endpoint_unavailable,保留原始 HTTP 状态和耗时,error 留空。
  • 顶层成功判定排除 skipped,至少需要一个非跳过项目且其余项目全部通过。Messages 或流式失败仍使整体失败。
  • 桌面表格和手机卡片显示黄色“跳过”及原因,通过率分母排除跳过项,并单独显示跳过数量。例如“已检测 2 项,2 项通过;另有 1 项可选检查已跳过”。
  • 401 / 403、429、5xx、超时、HTTP 200 错误正文和无效响应仍为失败;OpenAI 渠道的 models 404 / 405 不应用这项规则。

参考 sub2api 的处理边界:连接测试调用生成接口;模型目录同步在 404 / 405 且存在配置模型时,回退配置模型做能力补全。本 PR 保留 Five API 的逐接口诊断方式,以显式 skipped 表示缺少可选发现接口。

Validation

  • python -m pytest -q tests/test_channel_checks.py:35 passed,覆盖 404 / 405 跳过、生成失败、鉴权/限流/服务端错误、超时、无效 JSON、HTTP 200 内嵌错误、OpenAI 不跳过,以及仅跳过项不能判定成功。
  • 检测、管理 API 和渠道健康相关回归:70 passed。
  • npm run build:类型检查和生产构建通过。
  • Playwright 检查通过:原有批量检测和停止操作,以及新增跳过标签、跳过原因、计数排除、桌面及手机布局;无浏览器运行时错误。
  • python -X utf8 scripts/release_check.py、git diff --check:通过。

验证使用模拟上游,不调用真实厂商;未运行 MySQL / Redis 集成测试。

Upgrade

无需数据库迁移、配置调整或新增依赖。渠道检测接口新增 skipped 状态和可选 skip_reason 字段;顶层 success 按非跳过项汇总。设计文档和更新记录已同步。

@timmy1688

Copy link
Copy Markdown
Collaborator

感谢,今晚回去看看,后续该项目可能会移动至dromara组织,欢迎一起共建,成为核心贡献者
dromara/incubator#24

@timmy1688
timmy1688 merged commit 92be2eb into dromara:main Nov 5, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants