Skip to content

armgit / kokon

Public Imported from GitHub
0

Edit photos by describing the change, on your own GPU. A free, open-source alternative to Nano Banana and ChatGPT image editing: photos stay on your computer, no daily limit. One installer for Windows, Mac and Linux sets up the best open model (Qwen-Image 2.1). MCP server for AI agents.

Quick cut-out Stop: answer 409 for a stopped cut-out, log a run stopped by a dropped request

Gabriele Lozuponecb12ec446c32
diff --git a/crates/qls-core/src/error.rs b/crates/qls-core/src/error.rs
index 1e74fe9..8e0fcf2 100644
--- a/crates/qls-core/src/error.rs
+++ b/crates/qls-core/src/error.rs
@@ -76,6 +76,8 @@ impl AppError {
ErrorCode::Unauthorized | ErrorCode::LoginRequired => 401,
ErrorCode::Forbidden => 403,
ErrorCode::NotFound => 404,
+ // Stopped by the user (a quick cut-out): an answer, not a failure of the service.
+ ErrorCode::Cancelled => 409,
ErrorCode::QueueFull | ErrorCode::TooManyAttempts => 429,
ErrorCode::Unsupported => 422,
ErrorCode::ServerUnavailable | ErrorCode::ServerStartFailed | ErrorCode::ServerCrashed => 503,
diff --git a/crates/qls-service/src/api.rs b/crates/qls-service/src/api.rs
index f077afe..862dd11 100644
--- a/crates/qls-service/src/api.rs
+++ b/crates/qls-service/src/api.rs
@@ -535,8 +535,8 @@ async fn matte_image(State(s): St, Json(b): Json<MatteBody>) -> ApiResult<Respon
struct StopIfDropped(String, bool);
impl Drop for StopIfDropped {
fn drop(&mut self) {
- if !self.1 {
- qls_core::matting::cancel(&self.0);
+ if !self.1 && qls_core::matting::cancel(&self.0) {
+ tracing::info!("quick cut-out {} dropped by the app: its model run stopped", self.0);
}
}
}