|
10 | 10 |
|
11 | 11 | #ifdef LLAMA_BUILD_WEBUI |
12 | 12 | // auto generated files (see README.md for details) |
13 | | -#include "index.html.gz.hpp" |
| 13 | +#include "index.html.hpp" |
| 14 | +#include "bundle.js.hpp" |
| 15 | +#include "bundle.css.hpp" |
14 | 16 | #include "loading.html.hpp" |
15 | 17 | #endif |
16 | 18 |
|
@@ -272,16 +274,19 @@ bool server_http_context::init(const common_params & params) { |
272 | 274 | } else { |
273 | 275 | #ifdef LLAMA_BUILD_WEBUI |
274 | 276 | // using embedded static index.html |
275 | | - srv->Get(params.api_prefix + "/", [](const httplib::Request & req, httplib::Response & res) { |
276 | | - if (req.get_header_value("Accept-Encoding").find("gzip") == std::string::npos) { |
277 | | - res.set_content("Error: gzip is not supported by this browser", "text/plain"); |
278 | | - } else { |
279 | | - res.set_header("Content-Encoding", "gzip"); |
280 | | - // COEP and COOP headers, required by pyodide (python interpreter) |
281 | | - res.set_header("Cross-Origin-Embedder-Policy", "require-corp"); |
282 | | - res.set_header("Cross-Origin-Opener-Policy", "same-origin"); |
283 | | - res.set_content(reinterpret_cast<const char*>(index_html_gz), index_html_gz_len, "text/html; charset=utf-8"); |
284 | | - } |
| 277 | + srv->Get(params.api_prefix + "/", [](const httplib::Request & /*req*/, httplib::Response & res) { |
| 278 | + // COEP and COOP headers, required by pyodide (python interpreter) |
| 279 | + res.set_header("Cross-Origin-Embedder-Policy", "require-corp"); |
| 280 | + res.set_header("Cross-Origin-Opener-Policy", "same-origin"); |
| 281 | + res.set_content(reinterpret_cast<const char*>(index_html), index_html_len, "text/html; charset=utf-8"); |
| 282 | + return false; |
| 283 | + }); |
| 284 | + srv->Get(params.api_prefix + "/bundle.js", [](const httplib::Request & /*req*/, httplib::Response & res) { |
| 285 | + res.set_content(reinterpret_cast<const char*>(bundle_js), bundle_js_len, "application/javascript; charset=utf-8"); |
| 286 | + return false; |
| 287 | + }); |
| 288 | + srv->Get(params.api_prefix + "/bundle.css", [](const httplib::Request & /*req*/, httplib::Response & res) { |
| 289 | + res.set_content(reinterpret_cast<const char*>(bundle_css), bundle_css_len, "text/css; charset=utf-8"); |
285 | 290 | return false; |
286 | 291 | }); |
287 | 292 | #endif |
|
0 commit comments