mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-09-06 16:15:50 +08:00
- Replaced instances of `thinking.ApplyThinking` with `helps.ApplyRequestThinking` across all executors for consistency. - Updated `applyGeminiInteractionsThinking` to accept `cliproxyexecutor.Request` and `Options`. - Centralized logic for request thinking application to `helps` package for improved maintainability. Closes: #4618
21 lines
923 B
Go
21 lines
923 B
Go
package helps
|
|
|
|
import (
|
|
"github.com/router-for-me/CLIProxyAPI/v7/internal/thinking"
|
|
cliproxyauth "github.com/router-for-me/CLIProxyAPI/v7/sdk/cliproxy/auth"
|
|
cliproxyexecutor "github.com/router-for-me/CLIProxyAPI/v7/sdk/cliproxy/executor"
|
|
)
|
|
|
|
// ApplyRequestThinking preserves the registry lookup path unless the auth
|
|
// manager bound an exact configured API-key model definition to this attempt.
|
|
func ApplyRequestThinking(body []byte, req cliproxyexecutor.Request, opts cliproxyexecutor.Options, fromFormat, toFormat, provider string) ([]byte, error) {
|
|
if modelInfo, ok := cliproxyauth.ResolvedAPIKeyModelInfo(req); ok {
|
|
sourceBody := opts.OriginalRequest
|
|
if len(sourceBody) == 0 {
|
|
sourceBody = req.Payload
|
|
}
|
|
return thinking.ApplyThinkingWithModelInfo(body, sourceBody, req.Model, fromFormat, toFormat, provider, modelInfo)
|
|
}
|
|
return thinking.ApplyThinking(body, req.Model, fromFormat, toFormat, provider)
|
|
}
|