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

This commit is contained in:
JustSong
2023-05-15 17:34:09 +08:00
parent 44ebae1559
commit a1f61384c5
7 changed files with 78 additions and 19 deletions

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)