Skip to content

Fix: dispatch ModelEngine provider listing to the dedicated ModelEngi… - #3961

Open
lijiayang619 wants to merge 2 commits into
developfrom
fix/modelengine-provider
Open

lijiayang619 wants to merge 2 commits into
developfrom
fix/modelengine-provider

Conversation

@lijiayang619

Copy link
Copy Markdown
Contributor

修复ME批量导入失败的问题

…neProvider - get_provider_models routed every provider through the OpenAI-compatible adapter, so ModelEngine batch import failed (wrong endpoint path /open/router/v1/models, self-signed cert, custom type taxonomy, missing per-model base_url). The dedicated class existed but was never wired in.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The new ModelEngine dispatch path inherits ModelEngineProvider’s hard-disabled TLS verification and lacks the SSRF/TLS safeguards present in OpenAICompatibleProvider, which introduces a security regression if base_url is user-controlled.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity

Open (1)
What changed in this PR

该 PR 旨在修复 ModelEngine(ME)在批量导入/拉取模型列表时失败的问题:将 get_provider_models 对 ModelEngine 的模型枚举请求从通用 OpenAI 兼容适配器分发到专用的 ModelEngineProvider,以匹配其实际的 /open/router/v1/models 接口与返回格式。

Changes:

  • get_provider_modelsprovider=modelengine 的分支改为使用 ModelEngineProvider,其他 provider 仍走 OpenAICompatibleProvider
  • 更新单元测试:验证 ModelEngine 的 provider 分发点从 OpenAICompatibleProvider 切换为 ModelEngineProvider
File Description
backend/​services/​model_provider_service.py 为 ModelEngine provider 增加专用 provider 分发逻辑,以适配其非 OpenAI /models 路径与模型类型映射需求。
test/​backend/​services/​test_model_provider_service.py 更新测试 mock 目标与文案,覆盖 ModelEngine provider 的新分发路径。

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +47 to +51
provider_key = (model_data.get("provider") or "").lower()
if provider_key == ProviderEnum.MODELENGINE.value:
client: AbstractModelProvider = ModelEngineProvider()
else:
client = OpenAICompatibleProvider()
@codecov

codecov Bot commented Sep 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

… the update path only checked api_key emptiness while the create path also exempts open/router URLs (ModelEngine self-signed certs). The edit dialog prefills the real key and always submits it, so any edit silently broke connectivity. Exemption now checks the payload URL with a fallback to the stored record; batch-edit groups get the same protection
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