bug fix: stop server from sending empty json object before sending on_complete json object during oai chat streaming response

This commit is contained in:
Michael Coppola 2024-12-06 14:58:25 -05:00
parent f162d45a21
commit 859ce0cf89

View file

@ -3454,10 +3454,12 @@ int main(int argc, char ** argv) {
json res_json = result->to_json();
if (res_json.is_array()) {
for (const auto & res : res_json) {
if (!res.empty()) {
if (!server_sent_event(sink, "data", res)) {
return false;
}
}
}
return true;
} else {
return server_sent_event(sink, "data", res_json);