Merge pull request #2296 from seefs001/fix/adapter-missing
fix: volcengine claude DoResponse
This commit is contained in:
@@ -9,7 +9,6 @@ import (
|
|||||||
|
|
||||||
"github.com/QuantumNous/new-api/dto"
|
"github.com/QuantumNous/new-api/dto"
|
||||||
"github.com/QuantumNous/new-api/relay/channel"
|
"github.com/QuantumNous/new-api/relay/channel"
|
||||||
"github.com/QuantumNous/new-api/relay/channel/claude"
|
|
||||||
"github.com/QuantumNous/new-api/relay/channel/openai"
|
"github.com/QuantumNous/new-api/relay/channel/openai"
|
||||||
relaycommon "github.com/QuantumNous/new-api/relay/common"
|
relaycommon "github.com/QuantumNous/new-api/relay/common"
|
||||||
"github.com/QuantumNous/new-api/relay/constant"
|
"github.com/QuantumNous/new-api/relay/constant"
|
||||||
@@ -27,7 +26,7 @@ func (a *Adaptor) ConvertGeminiRequest(*gin.Context, *relaycommon.RelayInfo, *dt
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *Adaptor) ConvertClaudeRequest(c *gin.Context, info *relaycommon.RelayInfo, req *dto.ClaudeRequest) (any, error) {
|
func (a *Adaptor) ConvertClaudeRequest(c *gin.Context, info *relaycommon.RelayInfo, req *dto.ClaudeRequest) (any, error) {
|
||||||
adaptor := claude.Adaptor{}
|
adaptor := openai.Adaptor{}
|
||||||
return adaptor.ConvertClaudeRequest(c, info, req)
|
return adaptor.ConvertClaudeRequest(c, info, req)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,9 +40,13 @@ func (a *Adaptor) ConvertGeminiRequest(*gin.Context, *relaycommon.RelayInfo, *dt
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *Adaptor) ConvertClaudeRequest(c *gin.Context, info *relaycommon.RelayInfo, req *dto.ClaudeRequest) (any, error) {
|
func (a *Adaptor) ConvertClaudeRequest(c *gin.Context, info *relaycommon.RelayInfo, req *dto.ClaudeRequest) (any, error) {
|
||||||
|
if info.ChannelBaseUrl == DoubaoCodingPlan {
|
||||||
adaptor := claude.Adaptor{}
|
adaptor := claude.Adaptor{}
|
||||||
return adaptor.ConvertClaudeRequest(c, info, req)
|
return adaptor.ConvertClaudeRequest(c, info, req)
|
||||||
}
|
}
|
||||||
|
adaptor := openai.Adaptor{}
|
||||||
|
return adaptor.ConvertClaudeRequest(c, info, req)
|
||||||
|
}
|
||||||
|
|
||||||
func (a *Adaptor) ConvertAudioRequest(c *gin.Context, info *relaycommon.RelayInfo, request dto.AudioRequest) (io.Reader, error) {
|
func (a *Adaptor) ConvertAudioRequest(c *gin.Context, info *relaycommon.RelayInfo, request dto.AudioRequest) (io.Reader, error) {
|
||||||
if info.RelayMode != constant.RelayModeAudioSpeech {
|
if info.RelayMode != constant.RelayModeAudioSpeech {
|
||||||
@@ -341,7 +345,7 @@ func (a *Adaptor) DoRequest(c *gin.Context, info *relaycommon.RelayInfo, request
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *Adaptor) DoResponse(c *gin.Context, resp *http.Response, info *relaycommon.RelayInfo) (usage any, err *types.NewAPIError) {
|
func (a *Adaptor) DoResponse(c *gin.Context, resp *http.Response, info *relaycommon.RelayInfo) (usage any, err *types.NewAPIError) {
|
||||||
if info.RelayFormat == types.RelayFormatClaude {
|
if info.RelayFormat == types.RelayFormatClaude && info.ChannelBaseUrl == DoubaoCodingPlan {
|
||||||
if info.IsStream {
|
if info.IsStream {
|
||||||
return claude.ClaudeStreamHandler(c, resp, info, claude.RequestModeMessage)
|
return claude.ClaudeStreamHandler(c, resp, info, claude.RequestModeMessage)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user