Skip to content

feat: support custom request params (e.g., disable thinking) and enable default parameters (e.g., temperature) by model providers - #6896

Open
Qznan wants to merge 1 commit into
ChatGPTNextWeb:mainfrom
Qznan:feat/custom-request-params-and-disable-defaults
Open

Qznan wants to merge 1 commit into
ChatGPTNextWeb:mainfrom
Qznan:feat/custom-request-params-and-disable-defaults

Conversation

@Qznan

@Qznan Qznan commented Sep 11, 2026

Copy link
Copy Markdown
screen_shot
  • Add extraParams (JSON string) to modelConfig for injecting custom request body fields — e.g. {"thinking":{"type":"disabled"}} to turn off DeepSeek's thinking mode, or {"thinking":{"type":"enabled","budget_tokens":2000}} to control it. Merged into payload with core fields (messages/model/stream) protected from being overwritten.
  • Add 4 disable flags (disableTemperature/disableTopP/disablePresencePenalty/disableFrequencyPenalty); when checked the corresponding param is omitted from the request so the provider's default value is used (useful for providers like DeepSeek whose thinking models have their own optimal sampling defaults).
  • Introduce applyModelConfigExtras helper and apply it across all providers after requestPayload construction.
  • Bump config version to 4.3 with migration for the new fields.
  • Add UI checkboxes per sampling param + JSON editor block, plus i18n (cn/en); other locales fall back to en.

💻 变更类型 | Change Type

  • feat
  • fix
  • refactor
  • perf
  • style
  • test
  • docs
  • ci
  • chore
  • build

🔀 变更说明 | Description of Change

Two tightly related capabilities for finer-grained control over LLM requests:

1. Omit default sampling params (use provider defaults)

Today NextChat always sends temperature, top_p, presence_penalty, frequency_penalty with fixed defaults. Some providers (e.g. DeepSeek V3/R1, newer reasoning models) have their own sensible defaults — or even disallow certain params — and forcing ours can degrade output. Each param now has a "Do not send (use provider default)" checkbox; checked → the key is simply deleted from the request payload before it goes out.

2. Inject arbitrary custom params

Provider APIs keep evolving. Recent examples: DeepSeek's thinking block, Anthropic's reasoning, Alibaba's enable_search. Rather than adding one UI toggle per new param, a single JSON textarea accepts any key/value and merges it into the request body. Core fields (messages, model, stream) and the 4 sampling params above are protected so users can't accidentally break the request.

Both are handled by one helper, applyModelConfigExtras, called after every provider finishes building its requestPayload — no provider needs to know about the other's disable logic.

📝 补充信息 | Additional Information

  • 21 files changed, 382 insertions(+), 68 deletions(-)
  • Tested on providers with nested param structures (Google → generationConfig, Alibaba → parameters, Tencent → capitalizeKeys, Anthropic → no presence_penalty/frequency_penalty). Each has a short inline comment noting how disable flags interact with that provider's payload shape.
  • Config version bump 4.2 → 4.3 with migration block initialising all 5 new fields for existing users.
  • Chinese/English locale strings added; other languages automatically fall back to English.

…rams

- Add four 'do not send' checkboxes (temperature, top_p, presence_penalty,
  frequency_penalty) so provider defaults are used when unchecked
- Add a JSON editor block for custom request parameters, useful for
  provider-specific knobs such as DeepSeek thinking mode
  ({"thinking":{"type":"disabled"}})
- Introduce applyModelConfigExtras helper (accepting a narrow
  ModelConfigExtras interface to avoid providerName type widening) and
  apply it across all providers after requestPayload construction
- Bump config version to 4.3 with migration for the new fields
- Add UI checkboxes + JSON editor block, plus i18n (cn/en)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant