This commit is contained in:
Daniel 2024-02-28 23:36:10 +08:00
parent 9f69d7dc4a
commit 77885a8cc0
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
10 changed files with 35 additions and 3 deletions

View file

@ -75,8 +75,13 @@ func ChatGPT(msg string, contextMsgs []string, c *openai.Client, model string, m
return
}
func NewOpenAIClient(apiKey, apiProxy, apiBaseURL, apiUserAgent string) *openai.Client {
func NewOpenAIClient(apiKey, apiProxy, apiBaseURL, apiUserAgent, apiVersion, apiProvider string) *openai.Client {
config := openai.DefaultConfig(apiKey)
if "Azure" == apiProvider {
config = openai.DefaultAzureConfig(apiKey, apiBaseURL)
config.APIVersion = apiVersion
}
transport := &http.Transport{}
if "" != apiProxy {
proxyUrl, err := url.Parse(apiProxy)