From: Jhen-Jie Hong Date: Mon, 14 Aug 2023 22:14:14 +0000 (+0800) Subject: server : add missing /json-schema-to-grammar.mjs (#2616) X-Git-Tag: gguf-v0.4.0~319 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=3ebb00935f3f0522b75df49c2769ab1774b91380;p=pkg%2Fggml%2Fsources%2Fllama.cpp server : add missing /json-schema-to-grammar.mjs (#2616) fixes #2611 --- diff --git a/examples/server/server.cpp b/examples/server/server.cpp index 222dbcb4..99660455 100644 --- a/examples/server/server.cpp +++ b/examples/server/server.cpp @@ -15,6 +15,7 @@ #include "index.html.hpp" #include "index.js.hpp" #include "completion.js.hpp" +#include "json-schema-to-grammar.mjs.hpp" #ifndef SERVER_VERBOSE #define SERVER_VERBOSE 1 @@ -1218,6 +1219,12 @@ int main(int argc, char **argv) res.set_content(reinterpret_cast(&completion_js), completion_js_len, "application/javascript"); return false; }); + // this is only called if no index.html is found in the public --path + svr.Get("/json-schema-to-grammar.mjs", [](const Request &, Response &res) + { + res.set_content(reinterpret_cast(&json_schema_to_grammar_mjs), json_schema_to_grammar_mjs_len, "application/javascript"); + return false; }); + svr.Post("/completion", [&llama](const Request &req, Response &res) { auto lock = llama.lock();