feat(api-access): sync drag order into credential priority behind a toggle - #214
jiaxuan1101 wants to merge 1 commit into
Conversation
|
顺便借这个 PR 提一个后续优化的想法(与本 PR 互不影响): 当前的模型别名功能是把别名绑定到来源渠道,故障转移仍然只发生在同一 Provider 的多个凭据之间。如果能让每个模型单独配置一个故障转移列表(例如 claude-opus-4-5 → [凭据A, 凭据B, 凭据C]),没有显式配置的模型则默认沿用 Provider 级的故障转移顺序(比如本 PR 的"按列表顺序调度"),调度灵活性会再上一级——不同模型可以拥有各自独立的凭据优先链。 One related idea for a follow-up (independent of this PR): the current model-alias feature binds an alias to a source channel, and failover still happens only among credentials of the same provider. It would be nice if each model could have its own failover list (e.g. claude-opus-4-5 → [credential A, credential B, credential C]), while models without an explicit list keep the provider-level failover order (e.g. the schedule-by-list-order switch from this PR) as the default. That way different models can have their own independent credential chains. |
…oggle - Add an opt-in Schedule-by-list-order switch on the API Access page - Dragging a connection writes its list position into the priority field (first row highest), so the core fails over strictly from top to bottom within the category - Enabling the switch syncs priorities from the current category order immediately - Persist the toggle as api-access-order-scheduling in the GUI config (default off, backward compatible) - Add en/zh-CN labels and GUI config regression tests
7c4ad45 to
d316a9f
Compare
中文
背景
GUI 中拖动接入(Provider)排序目前只改变 config.yaml 里的数组顺序,而 CPA Core 调度时完全不使用这个顺序:选择器按 priority 分桶、只取最高可用档,档内按凭据的内容哈希 ID 排序(见 sdk/cliproxy/auth/selector.go)。因此拖拽排序对实际故障转移顺序没有影响。
改动
本 PR 通过核心已支持的 priority 字段让拖拽顺序生效:
验证
说明
English
Background
Drag-to-reorder on the API Access page currently only rewrites the array order in config.yaml, which the CPA core scheduler ignores entirely: selection groups credentials into priority buckets and picks from the highest available tier, ordering within a tier by the stable content-hash auth ID (see sdk/cliproxy/auth/selector.go).
Changes
This PR makes the drag order meaningful through the mechanism the core already supports: the per-credential priority field.
Validation
Notes