🎨 添加中间件 && 完善预设注入功能 && 新增流式传输
This commit is contained in:
21
server/middleware/email.go
Normal file
21
server/middleware/email.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"git.echol.cn/loser/ai_proxy/server/global"
|
||||
"git.echol.cn/loser/ai_proxy/server/model/common/response"
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
// ErrorToEmail 错误发送邮件中间件
|
||||
func ErrorToEmail() gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
defer func() {
|
||||
if err := recover(); err != nil {
|
||||
global.GVA_LOG.Error("panic error", zap.Any("error", err))
|
||||
response.FailWithMessage("服务器内部错误", c)
|
||||
}
|
||||
}()
|
||||
c.Next()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user