From 39f714394b4b9d4487022b7132375e364c89de65 Mon Sep 17 00:00:00 2001 From: Green Sky Date: Fri, 8 Aug 2025 15:02:54 +0200 Subject: [PATCH] update and some fixes --- external/CMakeLists.txt | 2 +- src/CMakeLists.txt | 4 ++-- src/solanaceae/llama-cpp-web/llama_cpp_web_impl.cpp | 5 ++++- src/test1.cpp | 6 ++---- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 533c675..8685fd0 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -53,7 +53,7 @@ endif() if (NOT TARGET httplib::httplib) FetchContent_Declare(httplib GIT_REPOSITORY https://github.com/yhirose/cpp-httplib.git - GIT_TAG v0.19.0 + GIT_TAG v0.22.0 EXCLUDE_FROM_ALL ) FetchContent_MakeAvailable(httplib) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 344cb07..6cc387b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -20,11 +20,11 @@ target_link_libraries(solanaceae_llama-cpp-web PUBLIC ######################################## -add_executable(test1 EXCLUDE_FROM_ALL +add_executable(solanaceae_llama-cpp-web_test1 EXCLUDE_FROM_ALL test1.cpp ) -target_link_libraries(test1 PUBLIC +target_link_libraries(solanaceae_llama-cpp-web_test1 PUBLIC solanaceae_llama-cpp-web ) diff --git a/src/solanaceae/llama-cpp-web/llama_cpp_web_impl.cpp b/src/solanaceae/llama-cpp-web/llama_cpp_web_impl.cpp index 1a94505..30fbfc5 100644 --- a/src/solanaceae/llama-cpp-web/llama_cpp_web_impl.cpp +++ b/src/solanaceae/llama-cpp-web/llama_cpp_web_impl.cpp @@ -33,7 +33,10 @@ bool LlamaCppWeb::isGood(void) { res.error() != httplib::Error::Success || res->status != 200 || res->body.empty() || - res->get_header_value("Content-Type") != "application/json" + ( + res->get_header_value("Content-Type") != "application/json" && + res->get_header_value("Content-Type") != "application/json; charset=utf-8" + ) ) { return false; } diff --git a/src/test1.cpp b/src/test1.cpp index dd72335..ee60b9f 100644 --- a/src/test1.cpp +++ b/src/test1.cpp @@ -5,13 +5,11 @@ #include #include -#include #include -#include -#include int main(void) { SimpleConfigModel scm; + scm.set("LlamaCppWeb", "server", std::string_view{"localhost:8081"}); LlamaCppWeb lcw{scm}; if (!lcw.isGood()) { @@ -30,7 +28,7 @@ int main(void) { {"top_p", 1.0}, // disable {"n_predict", 16}, {"stop", {".", "\n"}}, - {"gramar", ""} + {"grammar", ""} }) << "\n";