🎨 添加中间件 && 完善预设注入功能 && 新增流式传输

This commit is contained in:
2026-03-03 06:10:39 +08:00
parent e1c70fe218
commit 557c865948
16 changed files with 1010 additions and 12117 deletions

View File

@@ -0,0 +1,18 @@
package middleware
import (
"git.echol.cn/loser/ai_proxy/server/global"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
)
// ErrorLogger 错误日志中间件
func ErrorLogger() gin.HandlerFunc {
return func(c *gin.Context) {
c.Next()
// 记录错误
for _, err := range c.Errors {
global.GVA_LOG.Error("request error", zap.Error(err))
}
}
}