Revert "fix(gateway): 修复 base_url 包含 /chat/completions 时路径拼接错误"

This reverts commit 7fdc25df3c.
This commit is contained in:
ianshaw
2026-01-12 13:29:04 -08:00
parent 3402acb606
commit d85288a6c0
2 changed files with 1 additions and 7 deletions

View File

@@ -332,10 +332,7 @@ func (s *AccountTestService) testOpenAIAccountConnection(c *gin.Context, account
if err != nil { if err != nil {
return s.sendErrorAndEnd(c, fmt.Sprintf("Invalid base URL: %s", err.Error())) return s.sendErrorAndEnd(c, fmt.Sprintf("Invalid base URL: %s", err.Error()))
} }
// Remove /chat/completions suffix if present, then add /responses apiURL = strings.TrimSuffix(normalizedBaseURL, "/") + "/responses"
normalizedBaseURL = strings.TrimSuffix(normalizedBaseURL, "/")
normalizedBaseURL = strings.TrimSuffix(normalizedBaseURL, "/chat/completions")
apiURL = normalizedBaseURL + "/responses"
} else { } else {
return s.sendErrorAndEnd(c, fmt.Sprintf("Unsupported account type: %s", account.Type)) return s.sendErrorAndEnd(c, fmt.Sprintf("Unsupported account type: %s", account.Type))
} }

View File

@@ -738,9 +738,6 @@ func (s *OpenAIGatewayService) buildUpstreamRequest(ctx context.Context, c *gin.
if err != nil { if err != nil {
return nil, err return nil, err
} }
// Remove /chat/completions suffix if present, then add /responses
validatedURL = strings.TrimSuffix(validatedURL, "/")
validatedURL = strings.TrimSuffix(validatedURL, "/chat/completions")
targetURL = validatedURL + "/responses" targetURL = validatedURL + "/responses"
} }
default: default: