mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-10-15 07:20:26 +00:00
perf: flush response after response handled (close #364)
This commit is contained in:
@@ -5,13 +5,12 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/gin-gonic/gin"
|
||||
"io"
|
||||
"net/http"
|
||||
"one-api/common"
|
||||
"one-api/model"
|
||||
"strings"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -308,6 +307,7 @@ func relayTextHelper(c *gin.Context, relayMode int) *OpenAIErrorWithStatusCode {
|
||||
var textResponse TextResponse
|
||||
|
||||
defer func() {
|
||||
c.Writer.Flush()
|
||||
if consumeQuota {
|
||||
quota := 0
|
||||
completionRatio := 1.0
|
||||
|
Reference in New Issue
Block a user