mirror of
https://github.com/Finesssee/ProxyPilot.git
synced 2026-11-19 02:17:46 +00:00
codex: cap injected default instructions
This commit is contained in:
@@ -137,6 +137,11 @@ func ConvertOpenAIRequestToCodex(modelName string, inputRawJSON []byte, stream b
|
||||
out, _ = sjson.Set(out, "instructions", systemInstructions)
|
||||
} else {
|
||||
_, instructions := misc.CodexInstructionsForModel(modelName, "")
|
||||
// Keep this short: upstream validators can reject large instruction blocks.
|
||||
const maxInstructionsChars = 1024
|
||||
if len(instructions) > maxInstructionsChars {
|
||||
instructions = instructions[:maxInstructionsChars] + "\n...[truncated]..."
|
||||
}
|
||||
out, _ = sjson.Set(out, "instructions", instructions)
|
||||
}
|
||||
|
||||
|
||||
@@ -94,6 +94,11 @@ func ConvertOpenAIResponsesRequestToCodex(modelName string, inputRawJSON []byte,
|
||||
}
|
||||
|
||||
// Otherwise, inject standard Codex instructions.
|
||||
// Keep this short: upstream validators can reject large instruction blocks.
|
||||
const maxInstructionsChars = 1024
|
||||
if len(instructions) > maxInstructionsChars {
|
||||
instructions = instructions[:maxInstructionsChars] + "\n...[truncated]..."
|
||||
}
|
||||
rawJSON, _ = sjson.SetBytes(rawJSON, "instructions", instructions)
|
||||
return rawJSON
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user