chore: update go-openai dependency to v1.36.1 and improve OpenAI client configuration in headmasterHandler

This commit is contained in:
lixiangwuxian
2025-01-09 02:03:47 +08:00
parent 72d2aad13e
commit a2d8fe5e79
3 changed files with 7 additions and 4 deletions

View File

@@ -46,7 +46,10 @@ func headmasterHandler(msg model.Message) (reply model.Reply) {
}
func ask(from string, question string) (reply string) {
client := openai.NewClientWithConfig(openai.DefaultAzureConfig(config.ConfigManager.GetProperty("openai_api_key"), config.ConfigManager.GetProperty("openai_api_base_url")))
llmConfig := openai.DefaultAzureConfig(config.ConfigManager.GetProperty("openai_api_key"), config.ConfigManager.GetProperty("openai_api_base_url"))
llmConfig.APIType = openai.APITypeOpenAI
llmConfig.APIVersion = ""
client := openai.NewClientWithConfig(llmConfig)
resp, err := client.CreateChatCompletion(
context.Background(),
openai.ChatCompletionRequest{