mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-03 04:50:52 +08:00
refactor: simplify provider check logic in amp routes
Amp-Thread-ID: https://ampcode.com/threads/T-a18fd71c-32ce-4c29-93d7-09f082740e51
This commit is contained in:
@@ -188,14 +188,10 @@ func (m *AmpModule) registerManagementRoutes(engine *gin.Engine, baseHandler *ha
|
|||||||
if modelPart != "" {
|
if modelPart != "" {
|
||||||
normalized, _ := util.NormalizeGeminiThinkingModel(modelPart)
|
normalized, _ := util.NormalizeGeminiThinkingModel(modelPart)
|
||||||
// Only handle locally when we have a provider or a valid mapping; otherwise fall back to proxy
|
// Only handle locally when we have a provider or a valid mapping; otherwise fall back to proxy
|
||||||
hasProvider := false
|
hasProvider := len(util.GetProviderName(normalized)) > 0
|
||||||
if providers := util.GetProviderName(normalized); len(providers) > 0 {
|
if !hasProvider && m.modelMapper != nil {
|
||||||
hasProvider = true
|
|
||||||
} else if m.modelMapper != nil {
|
|
||||||
// Check if mapped model has provider (MapModel returns target only if it has providers)
|
// Check if mapped model has provider (MapModel returns target only if it has providers)
|
||||||
if mapped := m.modelMapper.MapModel(normalized); mapped != "" {
|
hasProvider = m.modelMapper.MapModel(normalized) != ""
|
||||||
hasProvider = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if hasProvider {
|
if hasProvider {
|
||||||
|
|||||||
Reference in New Issue
Block a user