feat: improve OpenAI messages compatibility for Claude Code
This commit is contained in:
@@ -44,6 +44,39 @@ func TestApplyCodexOAuthTransform_ToolContinuationPreservesInput(t *testing.T) {
|
||||
require.Equal(t, "fc1", second["call_id"])
|
||||
}
|
||||
|
||||
func TestApplyCodexOAuthTransform_MessagesBridgePromptCacheKeyIsHeaderOnly(t *testing.T) {
|
||||
reqBody := map[string]any{
|
||||
"model": "gpt-5.5",
|
||||
"prompt_cache_key": "anthropic-metadata-session-1",
|
||||
"input": []any{
|
||||
map[string]any{
|
||||
"type": "message",
|
||||
"role": "developer",
|
||||
"content": []any{
|
||||
map[string]any{
|
||||
"type": "input_text",
|
||||
"text": openAICompatClaudeCodeTodoGuardMarker,
|
||||
},
|
||||
},
|
||||
},
|
||||
map[string]any{
|
||||
"type": "message",
|
||||
"role": "user",
|
||||
"content": "hello",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
result := applyCodexOAuthTransformWithOptions(reqBody, codexOAuthTransformOptions{
|
||||
SkipDefaultInstructions: true,
|
||||
PreserveToolCallIDs: true,
|
||||
})
|
||||
|
||||
require.Equal(t, "anthropic-metadata-session-1", result.PromptCacheKey)
|
||||
require.True(t, result.Modified)
|
||||
require.NotContains(t, reqBody, "prompt_cache_key")
|
||||
}
|
||||
|
||||
func TestApplyCodexOAuthTransform_ToolContinuationPreservesNativeMessageAndReasoningIDs(t *testing.T) {
|
||||
reqBody := map[string]any{
|
||||
"model": "gpt-5.2",
|
||||
|
||||
Reference in New Issue
Block a user