fix: 使用openai兼容接口调用部分渠道在最终端点为claude原生端点下还是走了openai扣减input_token的逻辑

This commit is contained in:
Seefs
2026-02-07 14:21:19 +08:00
parent a30561d8d4
commit a972722367
10 changed files with 21 additions and 31 deletions

View File

@@ -365,10 +365,11 @@ 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) {
claudeAdaptor := claude.Adaptor{}
if info.IsStream {
switch a.RequestMode {
case RequestModeClaude:
return claude.ClaudeStreamHandler(c, resp, info)
return claudeAdaptor.DoResponse(c, resp, info)
case RequestModeGemini:
if info.RelayMode == constant.RelayModeGemini {
return gemini.GeminiTextGenerationStreamHandler(c, info, resp)
@@ -381,7 +382,7 @@ func (a *Adaptor) DoResponse(c *gin.Context, resp *http.Response, info *relaycom
} else {
switch a.RequestMode {
case RequestModeClaude:
return claude.ClaudeHandler(c, resp, info)
return claudeAdaptor.DoResponse(c, resp, info)
case RequestModeGemini:
if info.RelayMode == constant.RelayModeGemini {
return gemini.GeminiTextGenerationHandler(c, info, resp)