mirror of
https://github.com/eryajf/chatgpt-dingtalk.git
synced 2025-12-24 12:57:50 +08:00
fix: 修复升级go-openai版本之后azure不可用的问题 (#275)
This commit is contained in:
@@ -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{
|
||||
|
||||
@@ -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}}}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user