MCPcopy Index your code
hub / github.com/apache/answer / sendStreamData

Function sendStreamData

internal/controller/ai_controller.go:177–187  ·  view source on GitHub ↗

sendStreamData

(w http.ResponseWriter, data StreamResponse)

Source from the content-addressed store, hash-verified

175
176// sendStreamData
177func sendStreamData(w http.ResponseWriter, data StreamResponse) {
178 jsonData, err := json.Marshal(data)
179 if err != nil {
180 return
181 }
182
183 _, _ = fmt.Fprintf(w, "data: %s\n\n", string(jsonData))
184 if f, ok := w.(http.Flusher); ok {
185 f.Flush()
186 }
187}
188
189func (c *AIController) ChatCompletions(ctx *gin.Context) {
190 if !c.ensureAIChatEnabled(ctx) {

Callers 3

ChatCompletionsMethod · 0.85
processAIStreamMethod · 0.85
sendErrorResponseMethod · 0.85

Calls 1

FlushMethod · 0.80

Tested by

no test coverage detected