From 08f46f35a3c4386a515bd5bfcfd83ed312cfde38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E4=B8=AB=E8=AE=B2=E6=A2=B5?= Date: Sat, 8 Jul 2023 23:01:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=8D=87=E7=BA=A7go-o?= =?UTF-8?q?penai=E7=89=88=E6=9C=AC=E4=B9=8B=E5=90=8Eazure=E4=B8=8D?= =?UTF-8?q?=E5=8F=AF=E7=94=A8=E7=9A=84=E9=97=AE=E9=A2=98=20(#275)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/chatgpt/chatgpt.go | 7 +++++-- pkg/dingbot/dingbot.go | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/pkg/chatgpt/chatgpt.go b/pkg/chatgpt/chatgpt.go index 214c8d77..aea1c90f 100644 --- a/pkg/chatgpt/chatgpt.go +++ b/pkg/chatgpt/chatgpt.go @@ -39,9 +39,12 @@ func New(userId string) *ChatGPT { if public.Config.AzureOn { config = openai.DefaultAzureConfig( public.Config.AzureOpenAIToken, - "https://"+public.Config.AzureResourceName+".openai."+ - "azure.com/", + "https://"+public.Config.AzureResourceName+".openai.azure.com", ) + config.APIVersion = public.Config.AzureApiVersion + config.AzureModelMapperFunc = func(model string) string { + return public.Config.AzureDeploymentName + } } else { if public.Config.HttpProxy != "" { config.HTTPClient.Transport = &http.Transport{ diff --git a/pkg/dingbot/dingbot.go b/pkg/dingbot/dingbot.go index bf372e29..7e996be6 100644 --- a/pkg/dingbot/dingbot.go +++ b/pkg/dingbot/dingbot.go @@ -97,10 +97,10 @@ func (r ReceiveMsg) ReplyToDingtalk(msgType, msg string) (statuscode int, err er case string(TEXT): msgtmp = &TextMessage{Text: &Text{Content: msg}, MsgType: TEXT, At: &At{AtUserIds: []string{atUser}}} case string(MARKDOWN): - if atUser != "" { + if atUser != "" && r.ConversationType != "1" { msg = fmt.Sprintf("%s\n\n@%s", msg, atUser) } - msgtmp = &MarkDownMessage{MsgType: MARKDOWN, At: &At{AtUserIds: []string{atUser}}, MarkDown: &MarkDown{Title: "Markdown Type", Text: msg}} + msgtmp = &MarkDownMessage{MsgType: MARKDOWN, At: &At{AtUserIds: []string{atUser}}, MarkDown: &MarkDown{Title: "Markdown Msg", Text: msg}} default: msgtmp = &TextMessage{Text: &Text{Content: msg}, MsgType: TEXT, At: &At{AtUserIds: []string{atUser}}} }