Skip to content

Commit b94b109

Browse files
committed
server : indentation
1 parent 80724eb commit b94b109

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

examples/server/server.cpp

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2678,38 +2678,38 @@ int main(int argc, char **argv)
26782678
} else {
26792679
const auto chunked_content_provider = [task_id, &llama](size_t, httplib::DataSink &sink) {
26802680
while (true) {
2681-
task_result llama_result = llama.next_result(task_id);
2682-
if (!llama_result.error) {
2683-
std::vector<json> result_array = format_partial_response_oaicompat( llama_result);
2681+
task_result llama_result = llama.next_result(task_id);
2682+
if (!llama_result.error) {
2683+
std::vector<json> result_array = format_partial_response_oaicompat( llama_result);
26842684

2685-
for (auto it = result_array.begin(); it != result_array.end(); ++it)
2686-
{
2687-
if (!it->empty()) {
2688-
const std::string str =
2689-
"data: " +
2690-
it->dump(-1, ' ', false, json::error_handler_t::replace) +
2691-
"\n\n";
2692-
LOG_VERBOSE("data stream", {{"to_send", str}});
2693-
if (!sink.write(str.c_str(), str.size())) {
2694-
return false;
2685+
for (auto it = result_array.begin(); it != result_array.end(); ++it)
2686+
{
2687+
if (!it->empty()) {
2688+
const std::string str =
2689+
"data: " +
2690+
it->dump(-1, ' ', false, json::error_handler_t::replace) +
2691+
"\n\n";
2692+
LOG_VERBOSE("data stream", {{"to_send", str}});
2693+
if (!sink.write(str.c_str(), str.size())) {
2694+
return false;
2695+
}
26952696
}
26962697
}
2697-
}
2698-
if (llama_result.stop) {
2698+
if (llama_result.stop) {
2699+
break;
2700+
}
2701+
} else {
2702+
const std::string str =
2703+
"error: " +
2704+
llama_result.result_json.dump(-1, ' ', false,
2705+
json::error_handler_t::replace) +
2706+
"\n\n";
2707+
LOG_VERBOSE("data stream", {{"to_send", str}});
2708+
if (!sink.write(str.c_str(), str.size())) {
2709+
return false;
2710+
}
26992711
break;
27002712
}
2701-
} else {
2702-
const std::string str =
2703-
"error: " +
2704-
llama_result.result_json.dump(-1, ' ', false,
2705-
json::error_handler_t::replace) +
2706-
"\n\n";
2707-
LOG_VERBOSE("data stream", {{"to_send", str}});
2708-
if (!sink.write(str.c_str(), str.size())) {
2709-
return false;
2710-
}
2711-
break;
2712-
}
27132713
}
27142714
sink.done();
27152715
return true;

0 commit comments

Comments
 (0)