LLAMA_SERVER_NO_WEBUI → LLAMA_BUILD_WEBUI
This commit is contained in:
parent
9b4a763f56
commit
f6f5715a86
|
|
@ -108,7 +108,7 @@ option(LLAMA_BUILD_TESTS "llama: build tests" ${LLAMA_STANDALONE})
|
|||
option(LLAMA_BUILD_TOOLS "llama: build tools" ${LLAMA_STANDALONE})
|
||||
option(LLAMA_BUILD_EXAMPLES "llama: build examples" ${LLAMA_STANDALONE})
|
||||
option(LLAMA_BUILD_SERVER "llama: build server example" ${LLAMA_STANDALONE})
|
||||
option(LLAMA_SERVER_NO_WEBUI "llama: disable the embedded Web UI in server" OFF)
|
||||
option(LLAMA_BUILD_WEBUI "llama: build the embedded Web UI for server" ${LLAMA_STANDALONE})
|
||||
option(LLAMA_TOOLS_INSTALL "llama: install tools" ${LLAMA_TOOLS_INSTALL_DEFAULT})
|
||||
option(LLAMA_TESTS_INSTALL "llama: install tests" ON)
|
||||
|
||||
|
|
|
|||
|
|
@ -36,9 +36,9 @@ set(TARGET_SRCS
|
|||
server-models.h
|
||||
)
|
||||
|
||||
option(LLAMA_SERVER_NO_WEBUI "Disable the embedded Web UI" OFF)
|
||||
option(LLAMA_BUILD_WEBUI "Build the embedded Web UI" ${LLAMA_STANDALONE})
|
||||
|
||||
if (NOT LLAMA_SERVER_NO_WEBUI)
|
||||
if (LLAMA_BUILD_WEBUI)
|
||||
set(PUBLIC_ASSETS
|
||||
index.html.gz
|
||||
loading.html
|
||||
|
|
@ -55,8 +55,8 @@ if (NOT LLAMA_SERVER_NO_WEBUI)
|
|||
)
|
||||
set_source_files_properties(${output} PROPERTIES GENERATED TRUE)
|
||||
endforeach()
|
||||
add_definitions(-DLLAMA_BUILD_WEBUI)
|
||||
else()
|
||||
add_definitions(-DLLAMA_SERVER_NO_WEBUI)
|
||||
endif()
|
||||
|
||||
add_executable(${TARGET} ${TARGET_SRCS})
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
#include <string>
|
||||
#include <thread>
|
||||
|
||||
#ifndef LLAMA_SERVER_NO_WEBUI
|
||||
#ifdef LLAMA_BUILD_WEBUI
|
||||
// auto generated files (see README.md for details)
|
||||
#include "index.html.gz.hpp"
|
||||
#include "loading.html.hpp"
|
||||
|
|
@ -183,7 +183,7 @@ bool server_http_context::init(const common_params & params) {
|
|||
auto middleware_server_state = [this](const httplib::Request & req, httplib::Response & res) {
|
||||
bool ready = is_ready.load();
|
||||
if (!ready) {
|
||||
#ifndef LLAMA_SERVER_NO_WEBUI
|
||||
#ifdef LLAMA_BUILD_WEBUI
|
||||
auto tmp = string_split<std::string>(req.path, '.');
|
||||
if (req.path == "/" || tmp.back() == "html") {
|
||||
res.status = 503;
|
||||
|
|
@ -254,7 +254,7 @@ bool server_http_context::init(const common_params & params) {
|
|||
return 1;
|
||||
}
|
||||
} else {
|
||||
#ifndef LLAMA_SERVER_NO_WEBUI
|
||||
#ifdef LLAMA_BUILD_WEBUI
|
||||
// using embedded static index.html
|
||||
srv->Get(params.api_prefix + "/", [](const httplib::Request & req, httplib::Response & res) {
|
||||
if (req.get_header_value("Accept-Encoding").find("gzip") == std::string::npos) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue