update and some fixes

This commit is contained in:
Green Sky
2025-08-08 15:02:54 +02:00
parent 7e1b424adb
commit 39f714394b
4 changed files with 9 additions and 8 deletions

View File

@@ -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)

View File

@@ -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
)

View File

@@ -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;
}

View File

@@ -5,13 +5,11 @@
#include <nlohmann/json.hpp>
#include <iostream>
#include <random>
#include <vector>
#include <chrono>
#include <cstdint>
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";