-
-
Notifications
You must be signed in to change notification settings - Fork 377
feat: support provider model redirect rules #993
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
7f6045e
feat: support provider model redirect rules
ding113 69d7f52
fix: tighten provider redirect rule validation
ding113 5821b81
Merge origin/dev into feat/provider-model-routing-rules
ding113 69dffee
chore: format code (feat-provider-model-routing-rules-5821b81)
github-actions[bot] 14d6d6e
fix: harden provider redirect validation
ding113 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,33 @@ | ||
| { | ||
| "currentRules": "当前规则 ({count})", | ||
| "addNewRule": "添加新规则", | ||
| "matchTypeLabel": "匹配方式", | ||
| "matchTypeExact": "精确匹配", | ||
| "matchTypePrefix": "前缀匹配", | ||
| "matchTypeSuffix": "后缀匹配", | ||
| "matchTypeContains": "关键词匹配", | ||
| "matchTypeRegex": "正则匹配", | ||
| "orderHint": "靠前规则优先生效", | ||
| "maxRules": "最多只能添加 100 条重定向规则", | ||
| "saveRule": "保存规则", | ||
| "cancelEdit": "取消编辑", | ||
| "moveRuleUp": "上移规则", | ||
| "moveRuleDown": "下移规则", | ||
| "editRule": "编辑规则", | ||
| "deleteRule": "删除规则", | ||
| "ruleMoved": "规则在编辑期间发生了变化,请重试", | ||
| "sourceModel": "用户请求的模型", | ||
| "targetModel": "实际转发的模型", | ||
| "sourcePlaceholder": "例如: claude-sonnet-4-5-20250929", | ||
| "targetPlaceholder": "例如: glm-4.6", | ||
| "add": "添加", | ||
| "sourceEmpty": "源模型名称不能为空", | ||
| "sourceTooLong": "源模型名称过长", | ||
| "targetEmpty": "目标模型名称不能为空", | ||
| "targetTooLong": "目标模型名称过长", | ||
| "alreadyExists": "模型 \"{model}\" 已存在重定向规则", | ||
| "regexInvalid": "正则表达式无效", | ||
| "regexUnsafe": "正则表达式存在 ReDoS 风险", | ||
| "description": "将 Claude Code 客户端请求的模型(如 claude-sonnet-4.5)重定向到上游供应商实际支持的模型(如 glm-4.6、gemini-pro)。用于成本优化或接入第三方 AI 服务。", | ||
| "emptyState": "暂无重定向规则。添加规则后,系统将自动重写请求中的模型名称。" | ||
| } |
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message is hardcoded in Chinese. In a localized application, it's better to use a translation key or at least English as the default to ensure consistency across different locales, especially since the rest of the codebase appears to use English for logic and types.