mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-10-04 14:49:59 +08:00
- Detect native responses-lite requests via headers and client metadata. - Skip instructions normalization and synthetic session cloaking for native requests. - Preserve upstream completion output during websocket response forwarding. Closes: #5780
21 lines
796 B
Go
21 lines
796 B
Go
package helps
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/router-for-me/CLIProxyAPI/v7/internal/util"
|
|
cliproxyexecutor "github.com/router-for-me/CLIProxyAPI/v7/sdk/cliproxy/executor"
|
|
sdktranslator "github.com/router-for-me/CLIProxyAPI/v7/sdk/translator"
|
|
)
|
|
|
|
// IsNativeCodexRequest checks the client dialect for use inside Codex executors.
|
|
func IsNativeCodexRequest(body []byte, opts cliproxyexecutor.Options) bool {
|
|
for _, format := range []sdktranslator.Format{opts.SourceFormat, cliproxyexecutor.ResponseFormatOrSource(opts)} {
|
|
name := strings.TrimSpace(format.String())
|
|
if !strings.EqualFold(name, sdktranslator.FormatCodex.String()) && !strings.EqualFold(name, sdktranslator.FormatOpenAIResponse.String()) {
|
|
return false
|
|
}
|
|
}
|
|
return util.IsCodexResponsesLiteRequest(body, opts.Headers)
|
|
}
|