use serde::{Deserialize, Serialize};
use std::time::Duration;
#[derive(Debug, Clone)]
pub struct ProgressUpdate {
pub current_step: u32,
pub total_steps: u32,
}
#[derive(Debug, Clone)]
pub struct ComfyProgress {
pub current_step: u32,
pub total_steps: u32,
pub node_id: Option<String>,
pub prompt_id: String,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum ComfyStatus {
Queued,
Running { node_id: String },
Progress { step: u32, total: u32 },
Completed,
Failed { error: String },
}
#[derive(Debug, Clone)]
pub struct WsConfig {
pub reconnect_attempts: u32,
pub reconnect_delay: Duration,
pub message_timeout: Duration,
pub max_messages_per_prompt: usize,
pub max_total_messages: usize,
}
impl Default for WsConfig {
fn default() -> Self {
Self {
reconnect_attempts: 3,
reconnect_delay: Duration::from_secs(1),
message_timeout: Duration::from_secs(30),
max_messages_per_prompt: 10_000,
max_total_messages: 50_000,
}
}
}
#[derive(Debug, Clone)]
pub struct DownloadLimits {
pub max_image_bytes: usize,
pub download_timeout: Duration,
}
impl Default for DownloadLimits {
fn default() -> Self {
Self {
max_image_bytes: 100 * 1024 * 1024,
download_timeout: Duration::from_secs(60),
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ImageRef {
pub filename: String,
pub subfolder: String,
pub img_type: String,
}
#[derive(Debug, Clone)]
pub struct PromptHistory {
pub status: String,
pub completed: bool,
pub images: Vec<ImageRef>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct QueueStatus {
pub running: u32,
pub pending: u32,
}
#[derive(Debug, Clone)]
pub enum GenerationOutcome {
Completed { images: Vec<ImageRef> },
Failed { error: String },
TimedOut,
}