Merge pull request #6529 from wucm667/fix/issue-6521-preserve-passthrough-reasoning

fix(openai): preserve reasoning effort in API-key passthrough
This commit is contained in:
Wesley Liddick
2026-09-05 16:02:56 +08:00
committed by GitHub
2 changed files with 20 additions and 0 deletions
@@ -59,6 +59,9 @@ func shouldPreserveOpenAIResponsesNoneReasoningEffort(account *Account) bool {
if account == nil {
return false
}
if account.IsOpenAIPassthroughEnabled() {
return true
}
if account.IsOpenAIOAuthLike() {
return true
}
@@ -331,6 +331,23 @@ func TestFilterOpenAIResponsesNoneReasoningEffortForAccount(t *testing.T) {
}
}
func TestFilterOpenAIResponsesNoneReasoningEffortForAccount_APIKeyAutomaticPassthroughPreservesRequest(t *testing.T) {
body := []byte(`{"model":"qwen3.8-27b","input":"hi","max_output_tokens":20,"reasoning":{"effort":"none"},"presence_penalty":1.5}`)
account := &Account{
Platform: PlatformOpenAI,
Type: AccountTypeAPIKey,
Credentials: map[string]any{
"base_url": "https://compat.example/v1",
},
Extra: map[string]any{"openai_passthrough": true},
}
got, err := filterOpenAIResponsesNoneReasoningEffortForAccount(account, body)
require.NoError(t, err)
require.JSONEq(t, string(body), string(got))
}
// Lite 工具迁移到 input[].additional_tools 后,仍应按有工具请求处理。
func TestNormalizeOpenAIParallelToolCallsWithoutTools_KeepsResponsesLiteAdditionalTools(t *testing.T) {
liteBody := []byte(`{"input":[{"type":"message","role":"user","content":"hi"},{"type":"additional_tools","tools":[{"type":"function","name":"spawn_agent"}]}],"parallel_tool_calls":false}`)