fix: 阻止批量删除模型后被自动拉回#312
Open
panzeyu2013 wants to merge 1 commit into
Open
Conversation
删除模型后 reloadManagedCatalog(false) 在缓存为空时会穿透到远端拉取, 导致刚删除的模型被重新并入目录。同时 auto_associate_source_models 在路由读取时会自动重建已删除的模型条目。 三处修复: 1. read_managed_model_catalog: refresh_remote=false 时始终返回缓存 2. delete_model_catalog_entry: 删除时设置 unlinked 偏好阻止自动关联重建 3. read_account_pool_platform_catalog: 仅首次初始化时远端拉取,已初始化过的空目录不再穿透
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.
问题
从聚合 API 导入模型后,手动批量删除这些模型,在没有点击"上游同步"的情况下,系统自动将已删除的模型重新拉取回来。
根因
三处代码在模型目录缓存为空时会自动触发远端拉取或重建:
read_managed_model_catalog(false)— 缓存为空时穿透到gateway::fetch_models_for_picker()auto_associate_source_models— 路由读取时auto_create_platform_models=true自动重建已删除的条目read_account_pool_platform_catalog— 同样在缓存为空时穿透到远端拉取(仅影响有 OpenAI 账号的用户)修复
read_managed_model_catalogL77refresh_remote=false时始终返回缓存,不再因缓存为空而远端拉取delete_model_catalog_entryL1796unlinked偏好,阻止auto_associate_source_models自动重建read_account_pool_platform_catalogL857验证
修改集中在
crates/service/src/apikey/apikey_models.rs,建议运行: