소스 검색

fix: support AI Gateway, close #52

CaIon 2 년 전
부모
커밋
0004c1022d
1개의 변경된 파일2개의 추가작업 그리고 6개의 파일을 삭제
  1. 2 6
      controller/channel-test.go

+ 2 - 6
controller/channel-test.go

@@ -43,14 +43,10 @@ func testChannel(channel *model.Channel, request ChatRequest) (err error, openai
 	default:
 		request.Model = "gpt-3.5-turbo"
 	}
-	requestURL := common.ChannelBaseURLs[channel.Type]
+	requestURL := getFullRequestURL(channel.GetBaseURL(), "/v1/chat/completions", channel.Type)
+
 	if channel.Type == common.ChannelTypeAzure {
 		requestURL = getFullRequestURL(channel.GetBaseURL(), fmt.Sprintf("/openai/deployments/%s/chat/completions?api-version=2023-03-15-preview", request.Model), channel.Type)
-	} else {
-		if channel.GetBaseURL() != "" {
-			requestURL = channel.GetBaseURL()
-		}
-		requestURL += "/v1/chat/completions"
 	}
 
 	jsonData, err := json.Marshal(request)