Skip to content

Commit 3ebb009

Browse files
authored
server : add missing /json-schema-to-grammar.mjs (#2616)
fixes #2611
1 parent d783f79 commit 3ebb009

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

examples/server/server.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "index.html.hpp"
1616
#include "index.js.hpp"
1717
#include "completion.js.hpp"
18+
#include "json-schema-to-grammar.mjs.hpp"
1819

1920
#ifndef SERVER_VERBOSE
2021
#define SERVER_VERBOSE 1
@@ -1218,6 +1219,12 @@ int main(int argc, char **argv)
12181219
res.set_content(reinterpret_cast<const char*>(&completion_js), completion_js_len, "application/javascript");
12191220
return false; });
12201221

1222+
// this is only called if no index.html is found in the public --path
1223+
svr.Get("/json-schema-to-grammar.mjs", [](const Request &, Response &res)
1224+
{
1225+
res.set_content(reinterpret_cast<const char*>(&json_schema_to_grammar_mjs), json_schema_to_grammar_mjs_len, "application/javascript");
1226+
return false; });
1227+
12211228
svr.Post("/completion", [&llama](const Request &req, Response &res)
12221229
{
12231230
auto lock = llama.lock();

0 commit comments

Comments
 (0)