Commit d85288a6 authored by ianshaw's avatar ianshaw
Browse files

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

This reverts commit 7fdc25df.
parent 3402acb6
......@@ -332,10 +332,7 @@ func (s *AccountTestService) testOpenAIAccountConnection(c *gin.Context, account
if err != nil {
return s.sendErrorAndEnd(c, fmt.Sprintf("Invalid base URL: %s", err.Error()))
}
// Remove /chat/completions suffix if present, then add /responses
normalizedBaseURL = strings.TrimSuffix(normalizedBaseURL, "/")
normalizedBaseURL = strings.TrimSuffix(normalizedBaseURL, "/chat/completions")
apiURL = normalizedBaseURL + "/responses"
apiURL = strings.TrimSuffix(normalizedBaseURL, "/") + "/responses"
} else {
return s.sendErrorAndEnd(c, fmt.Sprintf("Unsupported account type: %s", account.Type))
}
......
......@@ -738,9 +738,6 @@ func (s *OpenAIGatewayService) buildUpstreamRequest(ctx context.Context, c *gin.
if err != nil {
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"
}
default:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment