feat: add OpenRouter quantization filter to exclude low-bit providers (rebased)#11717
Open
roomote[bot] wants to merge 2 commits intomainfrom
Open
feat: add OpenRouter quantization filter to exclude low-bit providers (rebased)#11717roomote[bot] wants to merge 2 commits intomainfrom
roomote[bot] wants to merge 2 commits intomainfrom
Conversation
Adds an opt-in checkbox to filter out low-bit quantization providers (FP4/FP6/Int4) when using OpenRouter, preventing broken CJK encoding. - Add openRouterExcludeLowQuantization to provider settings schema - Add buildProviderOptions() method to centralize provider options - Add UI checkbox in OpenRouter settings - Add i18n translations for all 18 locales - Add 6 tests for buildProviderOptions behavior Closes #11325
2 tasks
|
@roomote |
Contributor
Author
Translated the |
…es for all locales
|
@roomote |
Contributor
Author
Marked this PR as ready for review. All 30 tests pass and translations are complete. |
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.
Related GitHub Issue
Closes: #11325
Description
This PR attempts to address Issue #11325 by re-implementing the feature from PR #11366 on a clean branch from main, since that PR had unresolvable merge conflicts due to significant codebase changes since it was created.
Changes:
Schema (
packages/types/src/provider-settings.ts): AddedopenRouterExcludeLowQuantization: z.boolean().optional()to theopenRouterSchema.Handler (
src/api/providers/openrouter.ts): Added abuildProviderOptions()private method that centralizes provider option construction for bothcreateMessage()andcompletePrompt(). When the setting is enabled,provider.quantizationsis set to["fp16", "bf16", "fp8", "int8"], restricting to higher-precision providers. This also combines with the existing specific provider routing when both are set.UI (
webview-ui/src/components/settings/providers/OpenRouter.tsx): Added a checkbox labeled "Exclude low-bit quantization (FP4/FP6/Int4)" with a description explaining the CJK encoding fix.i18n: Added English translations and fallback values for all 17 non-English locales.
Test Procedure
src/api/providers/__tests__/openrouter.spec.tscoveringbuildProviderOptions():cd src && npx vitest run api/providers/__tests__/openrouter.spec.tsnode scripts/find-missing-translations.jsPre-Submission Checklist
Documentation Updates
Additional Notes
The setting defaults to off, preserving existing behavior. When enabled, it uses the OpenRouter documented
provider.quantizationsAPI field to restrict routing to higher-precision providers only. Feedback and guidance are welcome.Interactively review PR in Roo Code Cloud