From 26ef906c618988c47207be976f213ad834ebcd3c Mon Sep 17 00:00:00 2001 From: CaIon <1808837298@qq.com> Date: Fri, 8 Mar 2024 21:38:43 +0800 Subject: [PATCH] fix: fix claude channel test --- controller/channel-test.go | 6 ++++-- relay/channel/claude/adaptor.go | 2 -- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/controller/channel-test.go b/controller/channel-test.go index b14ee6a..4a2906b 100644 --- a/controller/channel-test.go +++ b/controller/channel-test.go @@ -52,6 +52,7 @@ func testChannel(channel *model.Channel, testModel string) (err error, openaiErr case common.ChannelTypeAli: c.Set("plugin", channel.Other) } + meta := relaycommon.GenRelayInfo(c) apiType := constant.ChannelType2APIType(channel.Type) adaptor := relay.GetAdaptor(apiType) @@ -60,13 +61,14 @@ func testChannel(channel *model.Channel, testModel string) (err error, openaiErr } if testModel == "" { testModel = adaptor.GetModelList()[0] + meta.UpstreamModelName = testModel } request := buildTestRequest() + request.Model = testModel + meta.UpstreamModelName = testModel adaptor.Init(meta, *request) - request.Model = testModel - meta.UpstreamModelName = testModel convertedRequest, err := adaptor.ConvertRequest(c, constant.RelayModeChatCompletions, request) if err != nil { return err, nil diff --git a/relay/channel/claude/adaptor.go b/relay/channel/claude/adaptor.go index bf93acc..45efd01 100644 --- a/relay/channel/claude/adaptor.go +++ b/relay/channel/claude/adaptor.go @@ -6,7 +6,6 @@ import ( "github.com/gin-gonic/gin" "io" "net/http" - "one-api/common" "one-api/dto" "one-api/relay/channel" relaycommon "one-api/relay/common" @@ -50,7 +49,6 @@ func (a *Adaptor) SetupRequestHeader(c *gin.Context, req *http.Request, info *re } func (a *Adaptor) ConvertRequest(c *gin.Context, relayMode int, request *dto.GeneralOpenAIRequest) (any, error) { - common.SysLog(fmt.Sprintf("Request mode: %d", a.RequestMode)) if request == nil { return nil, errors.New("request is nil") }