mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-03 04:50:52 +08:00
fix(codex): only override instructions in responses for OpenCode UA
This commit is contained in:
@@ -73,6 +73,10 @@ func useOpenCodeInstructions(userAgent string) bool {
|
||||
return strings.Contains(strings.ToLower(userAgent), userAgentOpenAISDK)
|
||||
}
|
||||
|
||||
func IsOpenCodeUserAgent(userAgent string) bool {
|
||||
return useOpenCodeInstructions(userAgent)
|
||||
}
|
||||
|
||||
func codexInstructionsForCodex(modelName, systemInstructions string) (bool, string) {
|
||||
entries, _ := codexInstructionsDir.ReadDir("codex_instructions")
|
||||
|
||||
@@ -120,7 +124,7 @@ func codexInstructionsForCodex(modelName, systemInstructions string) (bool, stri
|
||||
}
|
||||
|
||||
func CodexInstructionsForModel(modelName, systemInstructions, userAgent string) (bool, string) {
|
||||
if useOpenCodeInstructions(userAgent) {
|
||||
if IsOpenCodeUserAgent(userAgent) {
|
||||
return codexInstructionsForOpenCode(systemInstructions)
|
||||
}
|
||||
return codexInstructionsForCodex(modelName, systemInstructions)
|
||||
|
||||
Reference in New Issue
Block a user