From bed308c69cebe0084a88b002a48e7326ac3706e8 Mon Sep 17 00:00:00 2001 From: Henri Vasserman Date: Thu, 1 Jun 2023 01:15:48 +0300 Subject: [PATCH] Apply suggestions from code review Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- examples/server/server.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/server/server.cpp b/examples/server/server.cpp index 71d93cb33..ce9e3e6d7 100644 --- a/examples/server/server.cpp +++ b/examples/server/server.cpp @@ -2,8 +2,8 @@ #include "llama.h" #include "build-info.h" -#include -#include +#include "httplib.h" +#include "json.hpp" struct server_params { @@ -161,7 +161,7 @@ struct llama_server_context const bool penalize_nl = params.penalize_nl; llama_token id = 0; { - auto logits = llama_get_logits(ctx); + auto *logits = llama_get_logits(ctx); auto n_vocab = llama_n_vocab(ctx); // Apply params.logit_bias map @@ -692,7 +692,7 @@ int main(int argc, char **argv) llama.rewind(); llama_reset_timings(llama.ctx); - if (parse_options_completion(json::parse(req.body), llama, res) == false) { + if (!parse_options_completion(json::parse(req.body), llama, res)) { return; } @@ -847,10 +847,10 @@ int main(int argc, char **argv) }); svr.set_exception_handler([](const Request &, Response &res, std::exception_ptr ep) { - auto fmt = "500 Internal Server Error\n%s"; + const auto *fmt = "500 Internal Server Error\n%s"; char buf[BUFSIZ]; try { - std::rethrow_exception(ep); + std::rethrow_exception(std::move(ep)); } catch (std::exception &e) { snprintf(buf, sizeof(buf), fmt, e.what()); } catch (...) {