Repository navigation
fix(models): 模型列表未使用模型按名称首字母排序 - #188
Merged
Merged
Conversation
- 未使用过的模型改为按 name 字母序排列,不再依赖 API 返回顺序 - 使用次数与最近使用时间相同时补充按 name 排序,保证顺序稳定 - 新增 modelUtils 单元测试覆盖排序规则
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 返回的原始顺序,同一 provider 下的模型顺序不稳定,也不便查找。
改动
sortModelsByFrequency:未使用过的模型改为按模型name使用localeCompare排序name排序,保证顺序稳定src/utils/modelUtils.test.ts,覆盖未使用排序、使用优先、次数/时间/名称多级排序及 provider 分组内排序影响范围
测试
vitest run:166 files / 1476 tests 通过,21 skippedtsc -b:通过eslint、prettier --check:通过