fix: openai response time

This commit is contained in:
CalciumIon
2024-07-15 18:14:07 +08:00
parent 7029065892
commit 220ab412e2
2 changed files with 9 additions and 0 deletions

View File

@@ -40,6 +40,7 @@ func OpenaiStreamHandler(c *gin.Context, resp *http.Response, info *relaycommon.
go func() {
for scanner.Scan() {
info.SetFirstResponseTime()
ticker.Reset(time.Duration(constant.StreamingTimeout) * time.Second)
data := scanner.Text()
if len(data) < 6 { // ignore blank line or wrong format