mirror of
https://github.com/mudler/LocalAI.git
synced 2025-06-30 06:30:43 +00:00
don't use named events for data messages
see https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#event_stream_format - named events are superfluous for sequences of strictly data messages.
This commit is contained in:
parent
e011328c4f
commit
36b1f53354
1 changed files with 0 additions and 2 deletions
|
@ -346,13 +346,11 @@ func chatEndpoint(cm *ConfigMerger, debug bool, loader *model.ModelLoader, threa
|
||||||
enc := json.NewEncoder(&buf)
|
enc := json.NewEncoder(&buf)
|
||||||
enc.Encode(ev)
|
enc.Encode(ev)
|
||||||
|
|
||||||
fmt.Fprintf(w, "event: data\n\n")
|
|
||||||
fmt.Fprintf(w, "data: %v\n\n", buf.String())
|
fmt.Fprintf(w, "data: %v\n\n", buf.String())
|
||||||
log.Debug().Msgf("Sending chunk: %s", buf.String())
|
log.Debug().Msgf("Sending chunk: %s", buf.String())
|
||||||
w.Flush()
|
w.Flush()
|
||||||
}
|
}
|
||||||
|
|
||||||
w.WriteString("event: data\n\n")
|
|
||||||
resp := &OpenAIResponse{
|
resp := &OpenAIResponse{
|
||||||
Model: input.Model, // we have to return what the user sent here, due to OpenAI spec.
|
Model: input.Model, // we have to return what the user sent here, due to OpenAI spec.
|
||||||
Choices: []Choice{{FinishReason: "stop"}},
|
Choices: []Choice{{FinishReason: "stop"}},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue