Skip to content

feat: support custom request params and can use default parameters (Temperature...) by model providers - #6895

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

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

feat: support custom request params and can use default parameters by model provider

  • 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 extraParams (JSON string) to modelConfig for injecting custom
  request body fields (e.g. {"thinking":{"type":"disabled"}}); merged
  into payload with core fields (messages/model/stream) protected
- Add 4 disable flags (disableTemperature/disableTopP/
  disablePresencePenalty/disableFrequencyPenalty); when checked the
  corresponding param is omitted from the request so the provider's
  default is used
- 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
@Qznan Qznan closed this Sep 11, 2026
@Qznan
Qznan deleted the feat/custom-request-params-and-disable-defaults branch September 11, 2026 05:01
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