feat: publish sanitized custom.97 source

This commit is contained in:
cneicy committed 2026-10-27 20:43:39 +08:00
1 parent 8e6ed0317b
commit 86c0276156
1022 files changed
+69903 -19207

No files matched your search

+9 -8
View File
@@ -161,7 +161,7 @@ func StreamScannerHandler(c *gin.Context, resp *http.Response, info *relaycommon
gopool.Go(func() {
defer func() {
if r := recover(); r != nil {
logger.LogError(c, fmt.Sprintf("ping goroutine panic: %v", r))
logger.LogError(c, common.LogText("ping goroutine panic: %v", r))
info.StreamStatus.SetEndReason(relaycommon.StreamEndReasonPanic, fmt.Errorf("ping panic: %v", r))
stop()
}
@@ -185,7 +185,7 @@ func StreamScannerHandler(c *gin.Context, resp *http.Response, info *relaycommon
err = PingData(c)
}()
if err != nil {
logger.LogError(c, "ping data error: "+err.Error())
logger.LogError(c, common.LogText("ping data error: %s", err.Error()))
info.StreamStatus.SetEndReason(relaycommon.StreamEndReasonPingFail, err)
return
}
@@ -198,7 +198,7 @@ func StreamScannerHandler(c *gin.Context, resp *http.Response, info *relaycommon
// 监听客户端断开连接
return
case <-pingTimeout.C:
logger.LogError(c, "ping goroutine max duration reached")
logger.LogError(c, common.LogText("ping goroutine max duration reached"))
return
}
}
@@ -211,7 +211,7 @@ func StreamScannerHandler(c *gin.Context, resp *http.Response, info *relaycommon
gopool.Go(func() {
defer func() {
if r := recover(); r != nil {
logger.LogError(c, fmt.Sprintf("data handler goroutine panic: %v", r))
logger.LogError(c, common.LogText("data handler goroutine panic: %v", r))
info.StreamStatus.SetEndReason(relaycommon.StreamEndReasonPanic, fmt.Errorf("handler panic: %v", r))
}
stop()
@@ -238,7 +238,7 @@ func StreamScannerHandler(c *gin.Context, resp *http.Response, info *relaycommon
defer func() {
close(dataChan)
if r := recover(); r != nil {
logger.LogError(c, fmt.Sprintf("scanner goroutine panic: %v", r))
logger.LogError(c, common.LogText("scanner goroutine panic: %v", r))
info.StreamStatus.SetEndReason(relaycommon.StreamEndReasonPanic, fmt.Errorf("scanner panic: %v", r))
}
stop()
@@ -272,6 +272,7 @@ func StreamScannerHandler(c *gin.Context, resp *http.Response, info *relaycommon
continue
}
if !strings.HasPrefix(data, "[DONE]") {
info.UpstreamTiming.Mark("first_sse_data")
info.SetFirstResponseTime()
info.ReceivedResponseCount++
@@ -291,7 +292,7 @@ func StreamScannerHandler(c *gin.Context, resp *http.Response, info *relaycommon
if err := scanner.Err(); err != nil {
if err != io.EOF {
logger.LogError(c, "scanner error: "+err.Error())
logger.LogError(c, common.LogText("scanner error: %s", err.Error()))
info.StreamStatus.SetEndReason(relaycommon.StreamEndReasonScannerErr, err)
}
}
@@ -337,8 +338,8 @@ func StreamScannerHandler(c *gin.Context, resp *http.Response, info *relaycommon
cleanup(true)
if info.StreamStatus.IsNormalEnd() && !info.StreamStatus.HasErrors() {
logger.LogInfo(c, fmt.Sprintf("stream ended: %s", info.StreamStatus.Summary()))
logger.LogInfo(c, common.LogText("stream ended: %s", info.StreamStatus.Summary()))
} else {
logger.LogError(c, fmt.Sprintf("stream ended: %s, received=%d", info.StreamStatus.Summary(), info.ReceivedResponseCount))
logger.LogError(c, common.LogText("stream ended: %s, received=%d", info.StreamStatus.Summary(), info.ReceivedResponseCount))
}
}