eryajf / chatgpt-dingtalk

🎒 钉钉 & 🤖 GPT-3.5 让你的工作效率直接起飞 🚀 私聊群聊方式、单聊串聊模式、角色扮演、图片创作 🚀
https://wiki.eryajf.net
MIT License
2.1k stars 388 forks source link

使用azure时,APIKEY留空报空指针 #276

Open doufangyu opened 1 year ago

doufangyu commented 1 year ago

问题反馈

重要:提交问题时,请务必带上输出日志,以及个人排查的成果。

api_key: "" azure_on: true # 如果是true,则会走azure的openai接口 azure_resource_name: "" # 对应你的主个性域名 azure_deployment_name: "gpt-35-turbo" # 对应的是 /deployments/ 后边跟着的这个值 azure_api_version: "2023-05-15" # 对应的是请求中的 api-version 后边的值 azure_openai_token: ""

当我这么配置时, image

当我一旦在api_key后边填写内容时,程序会去直接连api.openai.com的地址

目前我无法使用azure

doufangyu commented 1 year ago

image

只要如上图位置留空,就会报错如下,并不会走azure的配置

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x48 pc=0x774eef]

goroutine 1 [running]:
github.com/charmbracelet/log.(*Logger).log(0x0?, 0x46fca0?, {0xe62f20?, 0xc0049ad8f0?}, {0x0?, 0xe85cc0?, 0xc0096c9d01?})
    /go/pkg/mod/github.com/charmbracelet/log@v0.2.1/logger.go:52 +0x4f
github.com/charmbracelet/log.(*Logger).Fatal(0xc001c43960?, {0xe62f20?, 0xc0049ad8f0?}, {0x0?, 0x203000?, 0xc000003a00?})
    /go/pkg/mod/github.com/charmbracelet/log@v0.2.1/logger.go:318 +0x3c
github.com/eryajf/chatgpt-dingtalk/pkg/logger.Fatal(...)
    /github/workspace/pkg/logger/logger.go:41
github.com/eryajf/chatgpt-dingtalk/config.LoadConfig()
    /github/workspace/config/config.go:261 +0x214
github.com/eryajf/chatgpt-dingtalk/public.InitSvc()
    /github/workspace/public/public.go:20 +0x1d
main.init.0()
    /github/workspace/main.go:23 +0x19