update and some fixes
This commit is contained in:
2
external/CMakeLists.txt
vendored
2
external/CMakeLists.txt
vendored
@@ -53,7 +53,7 @@ endif()
|
|||||||
if (NOT TARGET httplib::httplib)
|
if (NOT TARGET httplib::httplib)
|
||||||
FetchContent_Declare(httplib
|
FetchContent_Declare(httplib
|
||||||
GIT_REPOSITORY https://github.com/yhirose/cpp-httplib.git
|
GIT_REPOSITORY https://github.com/yhirose/cpp-httplib.git
|
||||||
GIT_TAG v0.19.0
|
GIT_TAG v0.22.0
|
||||||
EXCLUDE_FROM_ALL
|
EXCLUDE_FROM_ALL
|
||||||
)
|
)
|
||||||
FetchContent_MakeAvailable(httplib)
|
FetchContent_MakeAvailable(httplib)
|
||||||
|
@@ -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
|
test1.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(test1 PUBLIC
|
target_link_libraries(solanaceae_llama-cpp-web_test1 PUBLIC
|
||||||
solanaceae_llama-cpp-web
|
solanaceae_llama-cpp-web
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@@ -33,7 +33,10 @@ bool LlamaCppWeb::isGood(void) {
|
|||||||
res.error() != httplib::Error::Success ||
|
res.error() != httplib::Error::Success ||
|
||||||
res->status != 200 ||
|
res->status != 200 ||
|
||||||
res->body.empty() ||
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -5,13 +5,11 @@
|
|||||||
#include <nlohmann/json.hpp>
|
#include <nlohmann/json.hpp>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <random>
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <chrono>
|
|
||||||
#include <cstdint>
|
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
SimpleConfigModel scm;
|
SimpleConfigModel scm;
|
||||||
|
scm.set("LlamaCppWeb", "server", std::string_view{"localhost:8081"});
|
||||||
LlamaCppWeb lcw{scm};
|
LlamaCppWeb lcw{scm};
|
||||||
|
|
||||||
if (!lcw.isGood()) {
|
if (!lcw.isGood()) {
|
||||||
@@ -30,7 +28,7 @@ int main(void) {
|
|||||||
{"top_p", 1.0}, // disable
|
{"top_p", 1.0}, // disable
|
||||||
{"n_predict", 16},
|
{"n_predict", 16},
|
||||||
{"stop", {".", "\n"}},
|
{"stop", {".", "\n"}},
|
||||||
{"gramar", ""}
|
{"grammar", ""}
|
||||||
})
|
})
|
||||||
<< "\n";
|
<< "\n";
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user