禁用 gin 打印日志

This commit is contained in:
RockYang 2023-03-29 21:44:44 +08:00
parent bd41f742d2
commit d515e88d97
3 changed files with 5 additions and 1 deletions

View File

@ -176,6 +176,8 @@ func (s *Server) sendMessage(session types.ChatSession, role types.ChatRole, pro
if err != nil { // 数据解析出错
logger.Error(err, line)
replyChunkMessage(ws, types.WsMessage{Type: types.WsEnd, IsHelloMsg: false})
replyMessage(ws, ErrorMsg, false)
replyMessage(ws, "![](images/wx.png)", true)
break
}
// 初始化 role

View File

@ -6,6 +6,7 @@ import (
"github.com/gin-contrib/sessions"
"github.com/gin-contrib/sessions/cookie"
"github.com/gin-gonic/gin"
"io"
"io/fs"
"net/http"
logger2 "openai/logger"
@ -71,6 +72,7 @@ func NewServer(configPath string) (*Server, error) {
func (s *Server) Run(webRoot embed.FS, path string, debug bool) {
s.DebugMode = debug
gin.SetMode(gin.ReleaseMode)
gin.DefaultWriter = io.Discard
engine := gin.Default()
if debug {
engine.Use(corsMiddleware())

View File

@ -134,7 +134,7 @@ export default defineComponent({
toolBoxHeight: 61 + 42, //
inputBoxWidth: window.innerWidth - 20,
sending: false,
loading: false
loading: true
}
},