|
|
@@ -923,12 +923,8 @@ void Server::handleHealthCheck(const httplib::Request& req, httplib::Response& r
|
|
|
.count()},
|
|
|
{"version", sd_rest::VERSION_INFO.version_full}};
|
|
|
sendJsonResponse(res, response);
|
|
|
- LOG_DEBUG("About to call logHttpAccess");
|
|
|
- logHttpAccess(req, res, "health-check");
|
|
|
- LOG_DEBUG("logHttpAccess returned");
|
|
|
} catch (const std::exception& e) {
|
|
|
sendErrorResponse(res, std::string("Health check failed: ") + e.what(), 500);
|
|
|
- logHttpAccess(req, res, "health-check-error");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1349,6 +1345,9 @@ void Server::handleQueueStatus(const httplib::Request& /*req*/, httplib::Respons
|
|
|
case GenerationStatus::FAILED:
|
|
|
statusStr = "failed";
|
|
|
break;
|
|
|
+ case GenerationStatus::MODEL_LOADING:
|
|
|
+ statusStr = "model_loading";
|
|
|
+ break;
|
|
|
}
|
|
|
|
|
|
// Convert time points to timestamps
|
|
|
@@ -1418,6 +1417,9 @@ void Server::handleJobStatus(const httplib::Request& req, httplib::Response& res
|
|
|
case GenerationStatus::FAILED:
|
|
|
statusStr = "failed";
|
|
|
break;
|
|
|
+ case GenerationStatus::MODEL_LOADING:
|
|
|
+ statusStr = "model_loading";
|
|
|
+ break;
|
|
|
}
|
|
|
|
|
|
// Convert time points to timestamps
|
|
|
@@ -3069,10 +3071,7 @@ void Server::handleText2Img(const httplib::Request& req, httplib::Response& res)
|
|
|
sendErrorResponse(res, std::string("Invalid JSON: ") + e.what(), 400, "JSON_PARSE_ERROR", requestId);
|
|
|
} catch (const std::exception& e) {
|
|
|
sendErrorResponse(res, std::string("Text-to-image request failed: ") + e.what(), 500, "INTERNAL_ERROR", requestId);
|
|
|
- logHttpAccess(req, res, "text2img-error");
|
|
|
}
|
|
|
-
|
|
|
- logHttpAccess(req, res, "text2img");
|
|
|
}
|
|
|
|
|
|
void Server::handleImg2Img(const httplib::Request& req, httplib::Response& res) {
|
|
|
@@ -5155,13 +5154,6 @@ std::string Server::generateThumbnail(const std::string& imagePath, int size) {
|
|
|
}
|
|
|
|
|
|
void Server::logHttpAccess(const httplib::Request& req, const httplib::Response& res, const std::string& endpoint) {
|
|
|
- // Debug: Always print to see if function is called
|
|
|
- {
|
|
|
- std::ostringstream oss;
|
|
|
- oss << "logHttpAccess called for " << req.method << " " << req.path;
|
|
|
- LOG_DEBUG(oss.str());
|
|
|
- }
|
|
|
-
|
|
|
std::string clientIP = req.get_header_value("X-Forwarded-For");
|
|
|
if (clientIP.empty()) {
|
|
|
clientIP = req.remote_addr;
|
|
|
@@ -5180,8 +5172,11 @@ void Server::logHttpAccess(const httplib::Request& req, const httplib::Response&
|
|
|
logMessage += " [" + endpoint + "]";
|
|
|
}
|
|
|
|
|
|
- // Use LOG_INFO for now to ensure it shows up
|
|
|
- LOG_INFO("HTTP: " + logMessage);
|
|
|
+ if (res.status != 200) {
|
|
|
+ LOG_ERROR("HTTP: " + logMessage);
|
|
|
+ } else {
|
|
|
+ LOG_INFO("HTTP: " + logMessage);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
std::string& Server::getModelField(ModelType type) {
|