feat: automatically disable channel when error occurred (#59)

This commit is contained in:
JustSong
2023-05-15 17:34:09 +08:00
parent b1074b43d6
commit f43a810e8d
7 changed files with 78 additions and 19 deletions
+2
View File
@@ -62,6 +62,8 @@ func Distribute() func(c *gin.Context) {
}
}
c.Set("channel", channel.Type)
c.Set("channel_id", channel.Id)
c.Set("channel_name", channel.Name)
c.Request.Header.Set("Authorization", fmt.Sprintf("Bearer %s", channel.Key))
if channel.Type == common.ChannelTypeCustom || channel.Type == common.ChannelTypeAzure {
c.Set("base_url", channel.BaseURL)