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
Conversation
…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
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.
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.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).applyModelConfigExtrashelper and apply it across all providers after requestPayload construction.💻 变更类型 | Change Type
🔀 变更说明 | 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_penaltywith 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
thinkingblock, Anthropic'sreasoning, Alibaba'senable_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
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.