Merge pull request #1926 from seefs001/fix/claude-beta
fix: claude beta=true
This commit is contained in:
@@ -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 {
|
||||||
|
|||||||
@@ -105,7 +105,8 @@ type RelayInfo struct {
|
|||||||
UserQuota int
|
UserQuota int
|
||||||
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 {
|
|||||||
info.ClaudeConvertInfo = &ClaudeConvertInfo{
|
info.ClaudeConvertInfo = &ClaudeConvertInfo{
|
||||||
LastMessagesType: LastMessageTypeNone,
|
LastMessagesType: LastMessageTypeNone,
|
||||||
}
|
}
|
||||||
|
if c.Query("beta") == "true" {
|
||||||
|
info.IsClaudeBetaQuery = true
|
||||||
|
}
|
||||||
return info
|
return info
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user