Commit bc197184 by Seefs Committed by GitHub

Merge pull request #1926 from seefs001/fix/claude-beta

fix: claude beta=true
parents 65856164 946da497
...@@ -52,11 +52,16 @@ func (a *Adaptor) Init(info *relaycommon.RelayInfo) { ...@@ -52,11 +52,16 @@ func (a *Adaptor) Init(info *relaycommon.RelayInfo) {
} }
func (a *Adaptor) GetRequestURL(info *relaycommon.RelayInfo) (string, error) { func (a *Adaptor) GetRequestURL(info *relaycommon.RelayInfo) (string, error) {
baseURL := ""
if a.RequestMode == RequestModeMessage { if a.RequestMode == RequestModeMessage {
return fmt.Sprintf("%s/v1/messages", info.ChannelBaseUrl), nil baseURL = fmt.Sprintf("%s/v1/messages", info.ChannelBaseUrl)
} else { } else {
return fmt.Sprintf("%s/v1/complete", info.ChannelBaseUrl), nil baseURL = fmt.Sprintf("%s/v1/complete", info.ChannelBaseUrl)
} }
if info.IsClaudeBetaQuery {
baseURL = baseURL + "?beta=true"
}
return baseURL, nil
} }
func (a *Adaptor) SetupRequestHeader(c *gin.Context, req *http.Header, info *relaycommon.RelayInfo) error { func (a *Adaptor) SetupRequestHeader(c *gin.Context, req *http.Header, info *relaycommon.RelayInfo) error {
......
...@@ -106,6 +106,7 @@ type RelayInfo struct { ...@@ -106,6 +106,7 @@ type RelayInfo struct {
RelayFormat types.RelayFormat RelayFormat types.RelayFormat
SendResponseCount int SendResponseCount int
FinalPreConsumedQuota int // 最终预消耗的配额 FinalPreConsumedQuota int // 最终预消耗的配额
IsClaudeBetaQuery bool // /v1/messages?beta=true
PriceData types.PriceData PriceData types.PriceData
...@@ -279,6 +280,9 @@ func GenRelayInfoClaude(c *gin.Context, request dto.Request) *RelayInfo { ...@@ -279,6 +280,9 @@ func GenRelayInfoClaude(c *gin.Context, request dto.Request) *RelayInfo {
info.ClaudeConvertInfo = &ClaudeConvertInfo{ info.ClaudeConvertInfo = &ClaudeConvertInfo{
LastMessagesType: LastMessageTypeNone, LastMessagesType: LastMessageTypeNone,
} }
if c.Query("beta") == "true" {
info.IsClaudeBetaQuery = true
}
return info return info
} }
......
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 sign in to comment