feat: add OpenRouter quantization filter to exclude low-bit providers (rebased)#11717
feat: add OpenRouter quantization filter to exclude low-bit providers (rebased)#11717roomote[bot] wants to merge 3 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
|
@roomote |
Translated the |
…es for all locales
|
@roomote |
Marked this PR as ready for review. All 30 tests pass and translations are complete. |
|
@roomote |
Your PR is in great shape! Here's where things stand and what to do next: Current status:
Minor improvement pushed: I cached the Your next step: Wait for a maintainer to review. If no one responds within a few days, you could politely ping one of the requested reviewers in a comment asking if they've had a chance to look at it. No further code changes should be needed on your end unless a reviewer requests them. |
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