Skip to content

Commit

Permalink
fix: 修复升级go-openai版本之后azure不可用的问题 (#275)
Browse files Browse the repository at this point in the history
  • Loading branch information
eryajf authored Jul 8, 2023
1 parent 35842e3 commit 08f46f3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions pkg/chatgpt/chatgpt.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
4 changes: 2 additions & 2 deletions pkg/dingbot/dingbot.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}}}
}
Expand Down

0 comments on commit 08f46f3

Please sign in to comment.