fix(llm): 官方 OpenAI gpt-5 系列不下发 temperature,修复验证 400(#857) - #888
Merged
H-Chris233 merged 3 commits intoAug 3, 2026
Merged
Conversation
OpenAI 官方 gpt-5 系列在 Chat Completions 只接受默认 temperature=1, 传 0.3(内置默认)会被 400 拒绝,导致验证/润色全部失败。 官方渠道的 gpt-5* 不再下发 temperature,由服务端用默认值; gpt-4 等其余模型保持原行为。custom 预设显式温度不受影响。
Contributor
PR Reviewer Guide 🔍(Review updated until commit d73294b)Here are some key observations to aid the review process:
|
Android 胶囊走原生 overlay,tauri::WebviewWindow 无 set_ignore_cursor_events(桌面专用),导致 Android cargo check 编译失败(E0599)。cfg 门控跳过,触摸交互由系统处理。
Contributor
|
Persistent review updated to latest commit 4d55096 |
…emperature-fix # Conflicts: # openless-all/app/src-tauri/src/coordinator/capsule_focus.rs
Contributor
|
Persistent review updated to latest commit d73294b |
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.
User description
背景
issue #857:OpenAI 预设 + gpt-5 系列模型验证返回「供应商接口返回 400」,换回 gpt-4 系列正常。
根因
temperature: 0.3(openai_compatible_temperature_for_provider→DEFAULT_TEMPERATURE),且 UI 只对 custom 预设开放温度配置。Unsupported value: 'temperature' ... Only the default (1) value is supported.)。validate_llm_provider→chat/completions),所以同样的 400 直接体现在验证上;gpt-4 系列无此限制,因此换回 gpt-4 正常。修复(KISS)
chat_body()对 openai 官方渠道 + gpt-5 模型* 不再下发temperature,由服务端用默认值(1);其余模型(gpt-4 等)保持原 0.3 行为。chat_body()是所有 OpenAI 兼容 LLM 请求(验证/润色/翻译/QA/流式)的唯一下发点,一处修改全局生效。测试
cargo test --lib polish::tests:66 passed(新增 3 个:gpt-5 全家不下发、gpt-4 保持 0.3、custom 显式温度不受影响)cargo test --lib commands::providers:13 passedPR Type
Bug fix, Tests
Description
Fix OpenAI gpt-5 validation 400 by omitting temperature
Add gpt-5 family detection for official OpenAI models
Add tests for gpt-5, gpt-4, and custom provider behavior
Diagram Walkthrough
flowchart LR A["chat_body()"] --> B{"official OpenAI provider & gpt-5* model?"} B -- "yes" --> C["omit temperature"] B -- "no" --> D["send temperature (default or custom)"]File Walkthrough
polish.rs
Omit temperature for OpenAI gpt-5 modelsopenless-all/app/src-tauri/src/polish.rs
chat_body()for official OpenAI gpt-5family
openai_model_is_gpt5_family()helper for model normalizationtemperature