fix: error NotifyRootUser #812
This commit is contained in:
@@ -15,10 +15,13 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func StreamScannerHandler(c *gin.Context, resp *http.Response, info *relaycommon.RelayInfo, dataHandler func(data string) bool) {
|
func StreamScannerHandler(c *gin.Context, resp *http.Response, info *relaycommon.RelayInfo, dataHandler func(data string) bool) {
|
||||||
|
|
||||||
if resp == nil {
|
if resp == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
|
||||||
streamingTimeout := time.Duration(constant.StreamingTimeout) * time.Second
|
streamingTimeout := time.Duration(constant.StreamingTimeout) * time.Second
|
||||||
if strings.HasPrefix(info.UpstreamModelName, "o1") || strings.HasPrefix(info.UpstreamModelName, "o3") {
|
if strings.HasPrefix(info.UpstreamModelName, "o1") || strings.HasPrefix(info.UpstreamModelName, "o3") {
|
||||||
// twice timeout for thinking model
|
// twice timeout for thinking model
|
||||||
|
|||||||
@@ -15,14 +15,14 @@ func DisableChannel(channelId int, channelName string, reason string) {
|
|||||||
model.UpdateChannelStatusById(channelId, common.ChannelStatusAutoDisabled, reason)
|
model.UpdateChannelStatusById(channelId, common.ChannelStatusAutoDisabled, reason)
|
||||||
subject := fmt.Sprintf("通道「%s」(#%d)已被禁用", channelName, channelId)
|
subject := fmt.Sprintf("通道「%s」(#%d)已被禁用", channelName, channelId)
|
||||||
content := fmt.Sprintf("通道「%s」(#%d)已被禁用,原因:%s", channelName, channelId, reason)
|
content := fmt.Sprintf("通道「%s」(#%d)已被禁用,原因:%s", channelName, channelId, reason)
|
||||||
NotifyRootUser(subject, content, dto.NotifyTypeChannelUpdate)
|
NotifyRootUser(dto.NotifyTypeChannelUpdate, subject, content)
|
||||||
}
|
}
|
||||||
|
|
||||||
func EnableChannel(channelId int, channelName string) {
|
func EnableChannel(channelId int, channelName string) {
|
||||||
model.UpdateChannelStatusById(channelId, common.ChannelStatusEnabled, "")
|
model.UpdateChannelStatusById(channelId, common.ChannelStatusEnabled, "")
|
||||||
subject := fmt.Sprintf("通道「%s」(#%d)已被启用", channelName, channelId)
|
subject := fmt.Sprintf("通道「%s」(#%d)已被启用", channelName, channelId)
|
||||||
content := fmt.Sprintf("通道「%s」(#%d)已被启用", channelName, channelId)
|
content := fmt.Sprintf("通道「%s」(#%d)已被启用", channelName, channelId)
|
||||||
NotifyRootUser(subject, content, dto.NotifyTypeChannelUpdate)
|
NotifyRootUser(dto.NotifyTypeChannelUpdate, subject, content)
|
||||||
}
|
}
|
||||||
|
|
||||||
func ShouldDisableChannel(channelType int, err *dto.OpenAIErrorWithStatusCode) bool {
|
func ShouldDisableChannel(channelType int, err *dto.OpenAIErrorWithStatusCode) bool {
|
||||||
|
|||||||
Reference in New Issue
Block a user