MCPcopy Index your code
hub / github.com/LumaAI-API/Luma-API / SendChatData

Function SendChatData

common/openai_tools.go:104–113  ·  view source on GitHub ↗
(w http.ResponseWriter, model string, chatID, data string)

Source from the content-addressed store, hash-verified

102}
103
104func SendChatData(w http.ResponseWriter, model string, chatID, data string) {
105 dataRune := []rune(data)
106 for _, d := range dataRune {
107 respData := ConstructChatCompletionStreamReponse(model, chatID, string(d))
108 byteData, _ := json.Marshal(respData)
109 _, _ = fmt.Fprintf(w, "data: %s\n\n", string(byteData))
110 w.(http.Flusher).Flush()
111 time.Sleep(1 * time.Millisecond)
112 }
113}
114
115func SendChatDone(w http.ResponseWriter) {
116 _, _ = fmt.Fprintf(w, "data: [DONE]")

Callers 1

ChatCompletionsFunction · 0.92

Tested by

no test coverage detected