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,8 +3454,10 @@ int main(int argc, char ** argv) {
|
||||||
json res_json = result->to_json();
|
json res_json = result->to_json();
|
||||||
if (res_json.is_array()) {
|
if (res_json.is_array()) {
|
||||||
for (const auto & res : res_json) {
|
for (const auto & res : res_json) {
|
||||||
if (!server_sent_event(sink, "data", res)) {
|
if (!res.empty()) {
|
||||||
return false;
|
if (!server_sent_event(sink, "data", res)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue