diff --git a/process.go b/process.go index 9bbfd76..c381984 100644 --- a/process.go +++ b/process.go @@ -76,6 +76,9 @@ func processRequest(c *gin.Context, upstream *OPENAI_UPSTREAM, record *Record, s if !haveResponse { log.Println("Timeout upstream", upstream.Endpoint) errCtx = errors.New("timeout") + if shouldResponse { + c.AbortWithError(502, errCtx) + } cancel() } }() @@ -130,8 +133,6 @@ func processRequest(c *gin.Context, upstream *OPENAI_UPSTREAM, record *Record, s haveResponse = true log.Println("Error", err, upstream.SK, upstream.Endpoint) - log.Println("debug", r) - errCtx = err // abort to error handle