feat: 测试路径
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"gpt-load/internal/models"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -67,7 +68,14 @@ func (ch *AnthropicChannel) ValidateKey(ctx context.Context, key string) (bool,
|
||||
return false, fmt.Errorf("no upstream URL configured for channel %s", ch.Name)
|
||||
}
|
||||
|
||||
reqURL := upstreamURL.String() + "/v1/messages"
|
||||
validationEndpoint := ch.ValidationEndpoint
|
||||
if validationEndpoint == "" {
|
||||
validationEndpoint = "/v1/messages"
|
||||
}
|
||||
reqURL, err := url.JoinPath(upstreamURL.String(), validationEndpoint)
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("failed to join upstream URL and validation endpoint: %w", err)
|
||||
}
|
||||
|
||||
// Use a minimal, low-cost payload for validation
|
||||
payload := gin.H{
|
||||
|
Reference in New Issue
Block a user