INNER CODE UNIT · Go

latency

easegress-io/easegress · scripts/benchmark/aigateway/llm/main.go:158

		latency := globalLatency / time.Duration(len(chunks))

		w.Header().Set("Content-Type", "text/event-stream")

		for _, chunk := range chunks {
			if latency > 0 {
				time.Sleep(latency)
			}

			w.Write([]byte("data: "))
			data, err := json.Marshal(chunk)
			if err != nil {
				break
			}
			w.Write(data)
			w.Write([]byte("\n\n"))
			w.(http.Flusher).Flush()
		}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…