diff --git a/engine/controllers/server.cc b/engine/controllers/server.cc index 8aa4a7e86..271e00b1f 100644 --- a/engine/controllers/server.cc +++ b/engine/controllers/server.cc @@ -347,6 +347,15 @@ void server::LoadModel(const HttpRequestPtr& req, LOG_TRACE << "Load model"; auto& en = std::get(engines_[engine_type].engine); + if (engine_type == kLlamaEngine) { //fix for llamacpp engine first + auto config = file_manager_utils::GetCortexConfig(); + if (en->IsSupported("SetFileLogger")) { + en->SetFileLogger(config.maxLogLines, config.logFolderPath + "/" + + cortex_utils::logs_base_name); + } else { + LOG_WARN << "Method SetFileLogger is not supported yet"; + } + } en->LoadModel(req->getJsonObject(), [cb = std::move(callback)]( Json::Value status, Json::Value res) { auto resp = cortex_utils::CreateCortexHttpJsonResponse(res); diff --git a/engine/controllers/server.h b/engine/controllers/server.h index 58d112435..ed9e35933 100644 --- a/engine/controllers/server.h +++ b/engine/controllers/server.h @@ -24,6 +24,7 @@ #include "trantor/utils/SerialTaskQueue.h" #include "utils/dylib.h" #include "utils/json.hpp" + #ifndef SERVER_VERBOSE #define SERVER_VERBOSE 1 #endif diff --git a/engine/cortex-common/EngineI.h b/engine/cortex-common/EngineI.h index c5dcc8afe..08789fc5d 100644 --- a/engine/cortex-common/EngineI.h +++ b/engine/cortex-common/EngineI.h @@ -34,4 +34,7 @@ class EngineI { virtual void GetModels( std::shared_ptr jsonBody, std::function&& callback) = 0; + + virtual bool SetFileLogger(int max_log_lines, + const std::string& log_path) = 0; };