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:
parent
f162d45a21
commit
859ce0cf89
1 changed files with 4 additions and 2 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue