fix(models): validate active-model ref before persisting; avoid free-tier fallback - #601
Open
angri450 wants to merge 1 commit into
Open
fix(models): validate active-model ref before persisting; avoid free-tier fallback#601angri450 wants to merge 1 commit into
angri450 wants to merge 1 commit into
Conversation
…tier fallback - set_active_model now rejects unknown/disabled providers and models not in the provider's list with 400, instead of silently writing a dead ref. A dead active-model used to make every turn fall back to the first usable model (often a free-tier one with a daily quota), which surfaced as confusing 429 rate-limit errors. - resolve_first_model_ref sorts models whose id contains 'free' last, so an unusable default no longer lands on a daily-quota free model. Verified: PUT active-model with bad provider -> 400; bad model -> 400; valid ref -> 200.
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.
背景(问题链)
用户把默认偏好模型(/admin/models 的 active-model)设成还没配置好的模型时:
set_active_model不校验 ref 可用性,把死引用(不存在的 provider / 未启用的模型)静默写入 settingsstream_error / model_retry限流报错修改
1.
octop/api/routers/providers.pyset_active_model加校验SLASH_BAD_ARGS,不写库on_provider_changed2.
octop/infra/agents/providers/store.pyresolve_first_model_ref避开免费档free的模型排到最后,fallback 优先选付费/本地模型验证