From 76c20fd43b49a3ef03f8a4aba83b75a8addfecfa Mon Sep 17 00:00:00 2001 From: thxCode Date: Wed, 3 Jul 2024 17:17:37 +0800 Subject: [PATCH] fix: loss ending done data Signed-off-by: thxCode --- llama-box/main.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/llama-box/main.cpp b/llama-box/main.cpp index fc5dccb..731ce46 100644 --- a/llama-box/main.cpp +++ b/llama-box/main.cpp @@ -3131,6 +3131,12 @@ int main(int argc, char **argv) { continue; } + const std::string done = "data: [DONE] \n\n"; + if (!sink.write(done.c_str(), done.size())) { + sink.done(); + return false; + } + sink.done_with_trailer({{"X-Response-Tokens-Per-Second", std::to_string(json_value(result.data.at("timings"), "predicted_per_second", tps))}});