|
@@ -355,7 +355,7 @@ void Server::registerEndpoints() {
|
|
|
std::cout << "UI version: " << uiVersion << std::endl;
|
|
std::cout << "UI version: " << uiVersion << std::endl;
|
|
|
|
|
|
|
|
// Serve dynamic config.js that provides runtime configuration to the web UI
|
|
// Serve dynamic config.js that provides runtime configuration to the web UI
|
|
|
- m_httpServer->Get("/ui/config.js", [this, uiVersion](const httplib::Request& req, httplib::Response& res) {
|
|
|
|
|
|
|
+ m_httpServer->Get("/ui/config.js", [this, uiVersion](const httplib::Request& /*req*/, httplib::Response& res) {
|
|
|
// Generate JavaScript configuration with current server settings
|
|
// Generate JavaScript configuration with current server settings
|
|
|
std::ostringstream configJs;
|
|
std::ostringstream configJs;
|
|
|
configJs << "// Auto-generated configuration\n"
|
|
configJs << "// Auto-generated configuration\n"
|
|
@@ -609,7 +609,7 @@ void Server::registerEndpoints() {
|
|
|
m_httpServer->Get("/ui/.*", uiHandler);
|
|
m_httpServer->Get("/ui/.*", uiHandler);
|
|
|
|
|
|
|
|
// Redirect /ui to /ui/ to ensure proper routing
|
|
// Redirect /ui to /ui/ to ensure proper routing
|
|
|
- m_httpServer->Get("/ui", [](const httplib::Request& req, httplib::Response& res) {
|
|
|
|
|
|
|
+ m_httpServer->Get("/ui", [](const httplib::Request& /*req*/, httplib::Response& res) {
|
|
|
res.set_redirect("/ui/");
|
|
res.set_redirect("/ui/");
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
@@ -752,7 +752,7 @@ void Server::handleLogin(const httplib::Request& req, httplib::Response& res) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-void Server::handleLogout(const httplib::Request& req, httplib::Response& res) {
|
|
|
|
|
|
|
+void Server::handleLogout(const httplib::Request& /*req*/, httplib::Response& res) {
|
|
|
std::string requestId = generateRequestId();
|
|
std::string requestId = generateRequestId();
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
@@ -831,7 +831,7 @@ void Server::handleValidateToken(const httplib::Request& req, httplib::Response&
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-void Server::handleRefreshToken(const httplib::Request& req, httplib::Response& res) {
|
|
|
|
|
|
|
+void Server::handleRefreshToken(const httplib::Request& /*req*/, httplib::Response& res) {
|
|
|
std::string requestId = generateRequestId();
|
|
std::string requestId = generateRequestId();
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
@@ -885,7 +885,7 @@ void Server::handleGetCurrentUser(const httplib::Request& req, httplib::Response
|
|
|
void Server::setupCORS() {
|
|
void Server::setupCORS() {
|
|
|
// Use post-routing handler to set CORS headers after the response is generated
|
|
// Use post-routing handler to set CORS headers after the response is generated
|
|
|
// This ensures we don't duplicate headers that may be set by other handlers
|
|
// This ensures we don't duplicate headers that may be set by other handlers
|
|
|
- m_httpServer->set_post_routing_handler([](const httplib::Request& req, httplib::Response& res) {
|
|
|
|
|
|
|
+ m_httpServer->set_post_routing_handler([](const httplib::Request& /*req*/, httplib::Response& res) {
|
|
|
// Only add CORS headers if they haven't been set already
|
|
// Only add CORS headers if they haven't been set already
|
|
|
if (!res.has_header("Access-Control-Allow-Origin")) {
|
|
if (!res.has_header("Access-Control-Allow-Origin")) {
|
|
|
res.set_header("Access-Control-Allow-Origin", "*");
|
|
res.set_header("Access-Control-Allow-Origin", "*");
|
|
@@ -907,7 +907,7 @@ void Server::setupCORS() {
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-void Server::handleHealthCheck(const httplib::Request& req, httplib::Response& res) {
|
|
|
|
|
|
|
+void Server::handleHealthCheck(const httplib::Request& /*req*/, httplib::Response& res) {
|
|
|
try {
|
|
try {
|
|
|
nlohmann::json response = {
|
|
nlohmann::json response = {
|
|
|
{"status", "healthy"},
|
|
{"status", "healthy"},
|
|
@@ -921,7 +921,7 @@ void Server::handleHealthCheck(const httplib::Request& req, httplib::Response& r
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-void Server::handleApiStatus(const httplib::Request& req, httplib::Response& res) {
|
|
|
|
|
|
|
+void Server::handleApiStatus(const httplib::Request& /*req*/, httplib::Response& res) {
|
|
|
try {
|
|
try {
|
|
|
nlohmann::json response = {
|
|
nlohmann::json response = {
|
|
|
{"server", {
|
|
{"server", {
|
|
@@ -990,8 +990,8 @@ void Server::handleModelsList(const httplib::Request& req, httplib::Response& re
|
|
|
// Filter parameters
|
|
// Filter parameters
|
|
|
bool includeLoaded = req.get_param_value("loaded") == "true";
|
|
bool includeLoaded = req.get_param_value("loaded") == "true";
|
|
|
bool includeUnloaded = req.get_param_value("unloaded") == "true";
|
|
bool includeUnloaded = req.get_param_value("unloaded") == "true";
|
|
|
- bool includeMetadata = req.get_param_value("include_metadata") == "true";
|
|
|
|
|
- bool includeThumbnails = req.get_param_value("include_thumbnails") == "true";
|
|
|
|
|
|
|
+ (void)req.get_param_value("include_metadata"); // unused but kept for API compatibility
|
|
|
|
|
+ (void)req.get_param_value("include_thumbnails"); // unused but kept for API compatibility
|
|
|
|
|
|
|
|
// Get all models
|
|
// Get all models
|
|
|
auto allModels = m_modelManager->getAllModels();
|
|
auto allModels = m_modelManager->getAllModels();
|
|
@@ -1184,7 +1184,7 @@ void Server::handleModelsList(const httplib::Request& req, httplib::Response& re
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
-void Server::handleQueueStatus(const httplib::Request& req, httplib::Response& res) {
|
|
|
|
|
|
|
+void Server::handleQueueStatus(const httplib::Request& /*req*/, httplib::Response& res) {
|
|
|
try {
|
|
try {
|
|
|
if (!m_generationQueue) {
|
|
if (!m_generationQueue) {
|
|
|
sendErrorResponse(res, "Generation queue not available", 500);
|
|
sendErrorResponse(res, "Generation queue not available", 500);
|
|
@@ -1361,7 +1361,7 @@ void Server::handleCancelJob(const httplib::Request& req, httplib::Response& res
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-void Server::handleClearQueue(const httplib::Request& req, httplib::Response& res) {
|
|
|
|
|
|
|
+void Server::handleClearQueue(const httplib::Request& /*req*/, httplib::Response& res) {
|
|
|
try {
|
|
try {
|
|
|
if (!m_generationQueue) {
|
|
if (!m_generationQueue) {
|
|
|
sendErrorResponse(res, "Generation queue not available", 500);
|
|
sendErrorResponse(res, "Generation queue not available", 500);
|
|
@@ -3087,7 +3087,7 @@ void Server::handleInpainting(const httplib::Request& req, httplib::Response& re
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Utility endpoints
|
|
// Utility endpoints
|
|
|
-void Server::handleSamplers(const httplib::Request& req, httplib::Response& res) {
|
|
|
|
|
|
|
+void Server::handleSamplers(const httplib::Request& /*req*/, httplib::Response& res) {
|
|
|
try {
|
|
try {
|
|
|
nlohmann::json samplers = {
|
|
nlohmann::json samplers = {
|
|
|
{"samplers", {
|
|
{"samplers", {
|
|
@@ -3165,7 +3165,7 @@ void Server::handleSamplers(const httplib::Request& req, httplib::Response& res)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-void Server::handleSchedulers(const httplib::Request& req, httplib::Response& res) {
|
|
|
|
|
|
|
+void Server::handleSchedulers(const httplib::Request& /*req*/, httplib::Response& res) {
|
|
|
try {
|
|
try {
|
|
|
nlohmann::json schedulers = {
|
|
nlohmann::json schedulers = {
|
|
|
{"schedulers", {
|
|
{"schedulers", {
|
|
@@ -3214,7 +3214,7 @@ void Server::handleSchedulers(const httplib::Request& req, httplib::Response& re
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-void Server::handleParameters(const httplib::Request& req, httplib::Response& res) {
|
|
|
|
|
|
|
+void Server::handleParameters(const httplib::Request& /*req*/, httplib::Response& res) {
|
|
|
try {
|
|
try {
|
|
|
nlohmann::json parameters = {
|
|
nlohmann::json parameters = {
|
|
|
{"parameters", {
|
|
{"parameters", {
|
|
@@ -3432,7 +3432,7 @@ void Server::handleEstimate(const httplib::Request& req, httplib::Response& res)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-void Server::handleConfig(const httplib::Request& req, httplib::Response& res) {
|
|
|
|
|
|
|
+void Server::handleConfig(const httplib::Request& /*req*/, httplib::Response& res) {
|
|
|
std::string requestId = generateRequestId();
|
|
std::string requestId = generateRequestId();
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
@@ -3467,7 +3467,7 @@ void Server::handleConfig(const httplib::Request& req, httplib::Response& res) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-void Server::handleSystem(const httplib::Request& req, httplib::Response& res) {
|
|
|
|
|
|
|
+void Server::handleSystem(const httplib::Request& /*req*/, httplib::Response& res) {
|
|
|
try {
|
|
try {
|
|
|
nlohmann::json system = {
|
|
nlohmann::json system = {
|
|
|
{"system", {
|
|
{"system", {
|
|
@@ -3505,7 +3505,7 @@ void Server::handleSystem(const httplib::Request& req, httplib::Response& res) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-void Server::handleSystemRestart(const httplib::Request& req, httplib::Response& res) {
|
|
|
|
|
|
|
+void Server::handleSystemRestart(const httplib::Request& /*req*/, httplib::Response& res) {
|
|
|
try {
|
|
try {
|
|
|
nlohmann::json response = {
|
|
nlohmann::json response = {
|
|
|
{"message", "Server restart initiated. The server will shut down gracefully and exit. Please use a process manager to automatically restart it."},
|
|
{"message", "Server restart initiated. The server will shut down gracefully and exit. Please use a process manager to automatically restart it."},
|
|
@@ -4142,6 +4142,8 @@ nlohmann::json Server::checkModelCompatibility(const ModelManager::ModelInfo& mo
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
nlohmann::json Server::calculateSpecificRequirements(const std::string& modelType, const std::string& resolution, const std::string& batchSize) {
|
|
nlohmann::json Server::calculateSpecificRequirements(const std::string& modelType, const std::string& resolution, const std::string& batchSize) {
|
|
|
|
|
+ (void)modelType; // Suppress unused parameter warning
|
|
|
|
|
+
|
|
|
nlohmann::json specific = {
|
|
nlohmann::json specific = {
|
|
|
{"memory_requirements", nlohmann::json::object()},
|
|
{"memory_requirements", nlohmann::json::object()},
|
|
|
{"performance_impact", nlohmann::json::object()},
|
|
{"performance_impact", nlohmann::json::object()},
|
|
@@ -4379,6 +4381,8 @@ void Server::handleUnloadModelById(const httplib::Request& req, httplib::Respons
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void Server::handleModelTypes(const httplib::Request& req, httplib::Response& res) {
|
|
void Server::handleModelTypes(const httplib::Request& req, httplib::Response& res) {
|
|
|
|
|
+ (void)req; // Suppress unused parameter warning
|
|
|
|
|
+
|
|
|
std::string requestId = generateRequestId();
|
|
std::string requestId = generateRequestId();
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
@@ -4449,6 +4453,8 @@ void Server::handleModelTypes(const httplib::Request& req, httplib::Response& re
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void Server::handleModelDirectories(const httplib::Request& req, httplib::Response& res) {
|
|
void Server::handleModelDirectories(const httplib::Request& req, httplib::Response& res) {
|
|
|
|
|
+ (void)req; // Suppress unused parameter warning
|
|
|
|
|
+
|
|
|
std::string requestId = generateRequestId();
|
|
std::string requestId = generateRequestId();
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
@@ -4496,6 +4502,8 @@ void Server::handleModelDirectories(const httplib::Request& req, httplib::Respon
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void Server::handleRefreshModels(const httplib::Request& req, httplib::Response& res) {
|
|
void Server::handleRefreshModels(const httplib::Request& req, httplib::Response& res) {
|
|
|
|
|
+ (void)req; // Suppress unused parameter warning
|
|
|
|
|
+
|
|
|
std::string requestId = generateRequestId();
|
|
std::string requestId = generateRequestId();
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
@@ -4662,6 +4670,8 @@ void Server::handleConvertModel(const httplib::Request& req, httplib::Response&
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void Server::handleModelStats(const httplib::Request& req, httplib::Response& res) {
|
|
void Server::handleModelStats(const httplib::Request& req, httplib::Response& res) {
|
|
|
|
|
+ (void)req; // Suppress unused parameter warning
|
|
|
|
|
+
|
|
|
std::string requestId = generateRequestId();
|
|
std::string requestId = generateRequestId();
|
|
|
|
|
|
|
|
try {
|
|
try {
|