Repository navigation
Conversation
…leading 404 interface-not-found
…leading 404 interface-not-found
Author
|
@zxuexingzhijie 你好,这个 PR 在模型不支持时返回 model_not_supported 而非误导性的 404(#459)。准备好 review 了,谢谢! |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does
Closes #459 — when testing a model connection, if the configured model is not supported, the provider returns
404with body"code":"model_not_supported". ButModelConfigOpsService.parseErrorMessagematched the generic404branch first and showed the misleading message "接口未找到 (404),请检查 Base URL 或者路径配置地址", which sends users down the wrong path (they think the URL/path is wrong, not the model).Root cause
In
parseErrorMessage, the order of checks was:401→ auth error404→ "interface not found" ← matched first for the unsupported-model 404429→ quotaSince the unsupported-model response is a
404, it was caught by step 2 and never surfacedmodel_not_supported.Fix
model_not_supportedcheck before the generic404branch. It matches both the errorcode(model_not_supported) and the message text (unsupported model, case-insensitive), and returns a clear "模型不支持 (model_not_supported):请确认模型名称正确,且当前厂商/兼容模式支持该模型。"404(genuinely wrong Base URL / path) still reports "接口未找到" as before — no regression for that case.parseErrorMessagepackage-private (wasprivate) so it can be unit-tested directly, and added 4 cases toModelConfigOpsServiceTest:model_not_supported, generic404regression guard,401,429.Files changed
.../service/aimodelconfig/ModelConfigOpsService.javamodel_not_supporteddetection before404;parseErrorMessage→ package-private.../service/aimodelconfig/ModelConfigOpsServiceTest.javaparseErrorMessagetest casesNote
Only error-message mapping logic changed; no DB schema, no API contract, no behavior change beyond the corrected message.