This commit is contained in:
2024-02-18 16:45:37 +08:00
parent 990628b455
commit db7f0eb316
2 changed files with 19 additions and 9 deletions

View File

@@ -91,16 +91,9 @@ func processRequest(c *gin.Context, upstream *OPENAI_UPSTREAM, record *Record, s
}
// set timeout, default is 60 second
timeout := 60 * time.Second
timeout := time.Duration(upstream.Timeout) * time.Second
if requestBodyOK == nil && requestBody.Stream {
timeout = 5 * time.Second
}
if len(inBody) > 1024*128 {
timeout = 20 * time.Second
}
if upstream.Timeout > 0 {
// convert upstream.Timeout(second) to nanosecond
timeout = time.Duration(upstream.Timeout) * time.Second
timeout = time.Duration(upstream.StreamTimeout) * time.Second
}
// timeout out request