mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-09-03 06:35:00 +08:00
fix(codex): filter out prompt_cache_retention in OpenAI→Codex responses request conversion
Closes: #5068
This commit is contained in:
@@ -31,7 +31,7 @@ func ConvertOpenAIResponsesRequestToCodex(modelName string, inputRawJSON []byte,
|
||||
rawJSON = deleteCodexRequestFields(rawJSON, "service_tier")
|
||||
}
|
||||
|
||||
rawJSON = deleteCodexRequestFields(rawJSON, "truncation", "prompt_cache_options")
|
||||
rawJSON = deleteCodexRequestFields(rawJSON, "truncation", "prompt_cache_options", "prompt_cache_retention")
|
||||
rawJSON = stripCodexResponsesCacheBreakpoints(rawJSON)
|
||||
rawJSON = applyResponsesCompactionCompatibility(rawJSON)
|
||||
|
||||
|
||||
@@ -253,6 +253,7 @@ func TestConvertOpenAIResponsesRequestToCodexNormalizesRequiredFields(t *testing
|
||||
"service_tier":"standard",
|
||||
"truncation":"auto",
|
||||
"prompt_cache_options":{"mode":"implicit"},
|
||||
"prompt_cache_retention":"24h",
|
||||
"user":"request-owner",
|
||||
"input":[{"type":"message","role":"system","content":"hello"}]
|
||||
}`)
|
||||
@@ -283,6 +284,7 @@ func TestConvertOpenAIResponsesRequestToCodexNormalizesRequiredFields(t *testing
|
||||
"service_tier",
|
||||
"truncation",
|
||||
"prompt_cache_options",
|
||||
"prompt_cache_retention",
|
||||
"user",
|
||||
} {
|
||||
if gjson.GetBytes(output, path).Exists() {
|
||||
@@ -291,6 +293,30 @@ func TestConvertOpenAIResponsesRequestToCodexNormalizesRequiredFields(t *testing
|
||||
}
|
||||
}
|
||||
|
||||
func TestConvertOpenAIResponsesRequestToCodex_FiltersPromptCacheRetention(t *testing.T) {
|
||||
inputJSON := []byte(`{
|
||||
"model": "gpt-5.6-terra",
|
||||
"prompt_cache_retention": "24h",
|
||||
"input": [
|
||||
{
|
||||
"type": "message",
|
||||
"role": "user",
|
||||
"content": [
|
||||
{
|
||||
"type": "input_text",
|
||||
"text": "hello"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}`)
|
||||
|
||||
output := ConvertOpenAIResponsesRequestToCodex("gpt-5.6-terra", inputJSON, true)
|
||||
if gjson.GetBytes(output, "prompt_cache_retention").Exists() {
|
||||
t.Fatalf("prompt_cache_retention should be removed: %s", string(output))
|
||||
}
|
||||
}
|
||||
|
||||
// TestConvertSystemRoleToDeveloper_AssistantRole tests that assistant role is preserved
|
||||
func TestConvertSystemRoleToDeveloper_AssistantRole(t *testing.T) {
|
||||
inputJSON := []byte(`{
|
||||
|
||||
Reference in New Issue
Block a user