Skip to content

fix(provider-options): require manual apply for recommendations#1152

Merged
mengxi-ream merged 5 commits intomainfrom
fix/qwen-provider-option
Mar 18, 2026
Merged

fix(provider-options): require manual apply for recommendations#1152
mengxi-ream merged 5 commits intomainfrom
fix/qwen-provider-option

Conversation

@mengxi-ream
Copy link
Copy Markdown
Owner

@mengxi-ream mengxi-ream commented Mar 18, 2026

Type of Changes

  • 🐛 Bug fix (fix)
  • ✅ Test related (test)

Description

  • stop auto-applying recommended provider options at runtime so empty provider options stay empty
  • add a model-level recommendation popover that lets users review and manually apply suggested provider options
  • simplify provider options editor syncing so direct config updates immediately flow back into the JSON editor

Related Issue

Closes #1146

How Has This Been Tested?

  • Added unit tests
  • Verified through manual testing

Screenshots

  • N/A

Checklist

  • I have tested these changes locally
  • I have updated the documentation accordingly if necessary
  • My code follows the code style of this project
  • My changes do not break existing functionality
  • If my code was generated by AI, I have proofread and improved it as necessary.

Additional Information

  • This keeps recommended provider options discoverable in the UI without silently sending them on every request.

Summary by cubic

Stop auto-applying recommended provider options. Added a model-level popover to preview and manually apply them; apply now routes through form submit (stages on invalid, saves when valid) to avoid unexpected request payloads and keep the editor in sync.

  • New Features

    • Added a sparkles popover next to the model selector to preview recommended options and apply them on demand.
    • Trigger briefly highlights when a model first matches a recommendation; preview is read-only with formatted JSON.
  • Bug Fixes

    • Requests only include provider options when saved by the user; {} now clears options instead of falling back to defaults.
    • Applying recommendations now submits via the form; staged when invalid and auto-saved once valid.
    • JSON editor preserves local formatting on save and stays in sync with external updates.
    • Ensured Qwen/qwen models are matched to disable thinking mode.
    • Added unit tests for editor syncing, staged submission, the recommendation trigger, and recommendation metadata behavior.

Written for commit 93feb90. Summary will update on new commits.

@dosubot dosubot bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Mar 18, 2026
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 18, 2026

🦋 Changeset detected

Latest commit: 93feb90

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the fix label Mar 18, 2026
@dosubot dosubot bot added the app: browser extension Related to browser extension label Mar 18, 2026
@dosubot
Copy link
Copy Markdown

dosubot bot commented Mar 18, 2026

Documentation Updates

2 document(s) were updated by changes in this PR:

API Providers Configuration
View Changes
@@ -52,7 +52,7 @@
 
 #### Temperature and Provider Options
 - `temperature` is only used for LLM translation providers. It controls the creativity of AI-generated translations. If omitted, the provider's default is used.
-- `providerOptions` is a JSON object for advanced, provider-specific settings (such as enabling special modes or features). If provided, these options override any built-in defaults for the provider. See the [Vercel AI SDK documentation](https://ai-sdk.dev/providers/ai-sdk-providers) or your provider's official docs for supported options.
+- `providerOptions` is a JSON object for advanced, provider-specific settings (such as enabling special modes or features). Empty provider options (`{}`) explicitly means "no options" rather than falling back to any defaults. See the [Vercel AI SDK documentation](https://ai-sdk.dev/providers/ai-sdk-providers) or your provider's official docs for supported options.
 
 ### Referencing Providers
 Providers are referenced by their `id` (not `name`) in each feature's configuration. Each feature (translate, selection toolbar, input translation, video subtitles, vocabulary insight) independently selects its own provider, for example:
@@ -110,7 +110,8 @@
 - **Feature assignment badge:** Each provider card displays a badge showing the number of features assigned to it (e.g., "2 features") using the i18n key `options.apiProviders.badges.featureCount`. Hovering over the badge displays a tooltip listing all assigned features by their localized names. The badge count includes Language Detection assignments (when mode is LLM and the provider is selected). This badge replaces the previous "Translate" badge that indicated the default translation provider.
 - **Configure advanced options for LLM translation providers:** For providers that support LLM-based translation, an "Advanced Options" collapsible section is available in the provider config form. This section includes:
   - **Temperature**: A numeric input controlling the randomness/creativity of AI-generated translations. Lower values (e.g., 0) are more deterministic; higher values are more creative. Leave empty to use the provider's default.
-  - **Provider Options**: A JSON code editor for entering provider-specific advanced options (such as enabling special API features). The editor supports syntax highlighting, validation, and shows provider-specific defaults as placeholder text. A link to the Vercel AI SDK documentation is provided for reference. Invalid JSON is highlighted and an error message is shown.
+  - **Provider Options**: A JSON code editor for entering provider-specific advanced options (such as enabling special API features). The editor supports syntax highlighting and validation. Invalid JSON is highlighted and an error message is shown. A link to the Vercel AI SDK documentation is provided for reference.
+  - **Provider Options Recommendations**: For models that have recommended provider options, a sparkles icon appears next to the model selector. Clicking this icon opens a popover showing the recommended JSON configuration for the selected model. Users can review the recommendation and manually click "Apply" to apply these options to their configuration. The sparkles icon briefly highlights when a model is first selected that matches a recommendation. Empty provider options remain empty unless the user explicitly applies a recommendation—the system does not auto-apply recommended options.
 
 Configuration changes are managed reactively using Jotai atoms, ensuring that updates in the UI are immediately reflected in the underlying configuration. **All configuration changes, including drag-and-drop reordering, are applied optimistically in the UI and are written to storage in a serialized, race-condition-safe manner. The scroll position remains stable after reordering.**
 
@@ -154,7 +155,8 @@
 5. Select the desired model from the dropdown, or toggle "use custom model" and enter a custom model name. **For custom (OpenAI-compatible) providers, you can click the "Fetch available models" button next to the custom model input to retrieve and select a model from the provider's `/models` endpoint.** This requires both a valid baseURL and API key. The available models will be shown in a popover; selecting one will auto-fill the custom model field. For MiniMax, select from `MiniMax-M2` or `MiniMax-M2-Stable`. For Alibaba Cloud, available models include `qwen3-max`, `qwen3.5-plus`, `qwen3.5-flash`, and others. For Moonshot AI, available models include `kimi-k2`, `kimi-k2.5`, and various thinking models. For Hugging Face, popular models include `Qwen/Qwen3-32B`, `meta-llama/Llama-3.3-70B-Instruct`, `deepseek-ai/DeepSeek-V3.1`, and others. (Note: Edge TTS does not use models; it uses voice configurations instead.)
 6. **(For LLM translation providers only)**: Expand the **Advanced Options** section to configure:
     - **Temperature**: Enter a value to control the randomness/creativity of AI-generated translations. Lower values (e.g., 0) are more deterministic; higher values are more creative. Leave empty to use the provider's default.
-    - **Provider Options**: Enter provider-specific advanced options as JSON. The editor validates your input and shows provider-specific defaults as a placeholder. A link to the Vercel AI SDK documentation is provided for reference.
+    - **Provider Options**: Enter provider-specific advanced options as JSON. The editor validates your input. A link to the Vercel AI SDK documentation is provided for reference.
+    - **Recommendations**: If your selected model has recommended provider options, a sparkles icon appears next to the model selector. Click it to preview the recommended configuration, then manually click "Apply" to use these options.
 7. **(Optional)**: Expand the **Feature Providers** section to assign features to this provider. Toggle ON any feature you want to use with this provider. Toggles that are disabled indicate features already assigned to this provider.
 8. **Click the "Test Connection" button to verify connectivity.**
     - For most providers, if the API key is empty, the button is disabled.
Internationalization and Localization
View Changes
@@ -13,6 +13,30 @@
 - `apiKeyRequired`: Prompt to add an API key before fetching models
 - `searchModels`: Placeholder for the model search input (added for the searchable combobox)
 - `noModelsFound`: Message shown when no models match the search (added for the searchable combobox)
+
+#### Provider Options Recommendation Keys
+Provider configuration forms include a recommendation feature for model-specific provider options. These keys appear next to the model selector and enable users to preview and manually apply recommended options. The keys are under `options.apiProviders.form`:
+
+- **`providerOptionsRecommendationTrigger`**: Tooltip for the sparkles button that opens the recommendation popover (appears next to model selector)
+- **`providerOptionsRecommendationTitle`**: Title of the recommendation dialog/popover
+- **`providerOptionsRecommendationDescription`**: Description text explaining what the recommended options are for
+- **`providerOptionsRecommendationApply`**: Label for the "Apply" button to apply recommended options
+- **`providerOptionsRecommendationApplied`**: Label for the button after recommendations have been applied (applied state)
+
+**Example:**
+
+```yaml
+options:
+  apiProviders:
+    form:
+      providerOptionsRecommendationTrigger: View recommended provider options
+      providerOptionsRecommendationTitle: Recommended provider options detected
+      providerOptionsRecommendationDescription: Review and manually apply the recommended configuration.
+      providerOptionsRecommendationApply: Apply
+      providerOptionsRecommendationApplied: Applied
+```
+
+These keys support the manual provider options recommendation feature introduced in PR #1152, which replaced automatic runtime application with a user-controlled preview and apply workflow.
 
 When adding a new translation mode, add a new key under `options.translation.translationMode.mode` in every locale file, with a localized label for each mode.
 
@@ -943,6 +967,7 @@
 - **PR #1121**: Updated improve writing template prompt with {{originLanguage}} detection, 4-point language policy (previously 3 points), and revised example format with language annotations; replaced Example B with Japanese original text demonstrating verb conjugation errors
 - **PR #1127**: Added localized provider descriptions for three new AI providers (alibaba, moonshotai, huggingface) across all 8 supported languages
 - **PR #1126**: Added selection toolbar opacity configuration with 2 new keys under `options.floatingButtonAndToolbar.selectionToolbar.opacity` to control transparency of the toolbar and popovers
+- **PR #1152**: Added provider options recommendation keys with 5 new keys under `options.apiProviders.form.providerOptionsRecommendation*` to support manual preview and application of recommended provider options
 
 ### Example: Adding a New Provider Group
 **English:**

How did I do? Any feedback?  Join Discord

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0774666c65

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 issues found across 18 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name=".changeset/five-apricots-compare.md">

<violation number="1" location=".changeset/five-apricots-compare.md:1">
P1: Add the opening frontmatter fence. As written, this changeset file is malformed and the release tooling will skip its version bump metadata.</violation>
</file>

<file name="src/entrypoints/options/pages/api-providers/provider-config-form/components/provider-options-recommendation-trigger.tsx">

<violation number="1" location="src/entrypoints/options/pages/api-providers/provider-config-form/components/provider-options-recommendation-trigger.tsx:120">
P2: Applying a recommendation overwrites existing provider options instead of merging them.</violation>
</file>

<file name="src/utils/constants/models.ts">

<violation number="1" location="src/utils/constants/models.ts:112">
P2: This regex still misses model names that start with `qwq`, so some QwQ models will not get `enableThinking: false`.</violation>
</file>

<file name="src/entrypoints/options/pages/api-providers/provider-config-form/translate-model-selector.tsx">

<violation number="1" location="src/entrypoints/options/pages/api-providers/provider-config-form/translate-model-selector.tsx:28">
P2: Applying a recommendation deep-merges `providerOptions` instead of replacing them, so stale option keys can survive and the recommendation never becomes fully applied.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread .changeset/five-apricots-compare.md
Comment thread src/utils/constants/models.ts
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b4cffa86ab

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/utils/providers/options.ts
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Mar 18, 2026
@mengxi-ream mengxi-ream merged commit d3dc6bd into main Mar 18, 2026
6 checks passed
@mengxi-ream mengxi-ream deleted the fix/qwen-provider-option branch March 18, 2026 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: browser extension Related to browser extension fix lgtm This PR has been approved by a maintainer size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] 1.30更新后, Cerebras Qwen 3 235B Instruct 500错误 ('body.enableThinking' is unsupported)

2 participants