fix(models): stop auto-populating fallbacks on every save#191
Closed
lizheng31 wants to merge 1 commit intoqingchencloud:mainfrom
Closed
fix(models): stop auto-populating fallbacks on every save#191lizheng31 wants to merge 1 commit intoqingchencloud:mainfrom
lizheng31 wants to merge 1 commit intoqingchencloud:mainfrom
Conversation
applyDefaultModel() now only syncs the primary model. fallbacks and defaults.models are only initialized when empty (first install), not overwritten on every save. This prevents the curated fallback chain from being replaced with ALL non-primary models on every models-page action, which was causing frequent failover stalls/hangs. Fixes: qingchencloud#190
Contributor
|
感谢提交!这个问题确实存在,修复思路也是对的。不过我在审查时发现 PR 中 defaults.models 被误改成了 defaults.model.models(字段路径不同,前者是 �gents.defaults.models,后者会写到 �gents.defaults.model.models),会导致 models map 写到错误位置。 我已经基于你的思路在 main 上提交了修正版本(699cf1c),保留了正确的字段路径。核心逻辑与你的 PR 一致:只同步 primary,fallbacks 和 models 仅在为空时初始化。 Closes #190 |
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.
Summary applyDefaultModel() currently overwrites agents.defaults.model.fallbacks with ALL non-primary models on every save (add/edit/delete/sort/set-primary on the models page). As the model list grows, this creates an ever-expanding fallback chain that causes frequent failover stalls. ## What changed applyDefaultModel(state) now only syncs defaults.model.primary on every save. The fallbacks and defaults.models fields are only initialized when they are empty (first install scenario), not blindly overwritten. This preserves user-curated fallback chains while keeping the primary-model validation logic intact. ## Behavior | Scenario | Before | After | |----------|--------|-------| | Every save on models page | Fallback = ALL non-primary models | Fallback unchanged | | First install (empty fallback) | Initializes with all models | Initializes with all models | | Primary model deleted | Auto-switches to first model | Auto-switches | ## Cross-platform note This fix touches only src/pages/models.js, the React web frontend. It applies equally to Windows, macOS, and Linux deployments. Fixes #190