refactor and prep rpbot

This commit is contained in:
2024-01-23 23:05:55 +01:00
parent c497b19b20
commit e504d7a8ef
10 changed files with 129 additions and 12 deletions

View File

@@ -19,7 +19,7 @@ static std::string convertToSafeGrammarString(std::string_view input) {
LlamaCppWeb::~LlamaCppWeb(void) {
}
bool LlamaCppWeb::isHealthy(void) {
bool LlamaCppWeb::isGood(void) {
auto res = _cli.Get("/health");
if (
res.error() != httplib::Error::Success ||
@@ -123,7 +123,8 @@ std::string LlamaCppWeb::completeLine(const std::string_view prompt) {
}
nlohmann::json LlamaCppWeb::complete(const nlohmann::json& request_j) {
if (!isHealthy()) {
// TODO: dont check ourself
if (!isGood()) {
return {};
}