mirror of
https://github.com/Finesssee/ProxyPilot.git
synced 2026-11-19 02:17:46 +00:00
codex: avoid role=system in input
This commit is contained in:
@@ -110,6 +110,11 @@ func ConvertOpenAIRequestToCodex(modelName string, inputRawJSON []byte, stream b
|
||||
for i := 0; i < len(arr); i++ {
|
||||
m := arr[i]
|
||||
role := m.Get("role").String()
|
||||
if role == "system" {
|
||||
// Codex backend rejects role=system in input ("System messages are not allowed").
|
||||
// Preserve the content by downgrading to a user message.
|
||||
role = "user"
|
||||
}
|
||||
|
||||
switch role {
|
||||
case "tool":
|
||||
|
||||
@@ -49,9 +49,10 @@ func ConvertOpenAIResponsesRequestToCodex(modelName string, inputRawJSON []byte,
|
||||
inputResults = []gjson.Result{}
|
||||
}
|
||||
|
||||
// Preserve caller instructions by converting them into an explicit system message inside "input".
|
||||
// Preserve caller instructions by converting them into an explicit leading user message inside "input".
|
||||
// Note: Codex backend rejects role=system in input ("System messages are not allowed").
|
||||
if strings.TrimSpace(originalInstructionsText) != "" {
|
||||
sys := `{"type":"message","role":"system","content":[{"type":"input_text","text":""}]}`
|
||||
sys := `{"type":"message","role":"user","content":[{"type":"input_text","text":""}]}`
|
||||
sys, _ = sjson.Set(sys, "content.0.text", originalInstructionsText)
|
||||
|
||||
newInput := "[]"
|
||||
|
||||
Reference in New Issue
Block a user