1use serde::{Deserialize, Serialize};
2use std::time::Duration;
3
4#[derive(Debug, Clone)]
6pub struct ProgressUpdate {
7 pub current_step: u32,
8 pub total_steps: u32,
9}
10
11#[derive(Debug, Clone)]
13pub struct ComfyProgress {
14 pub current_step: u32,
16 pub total_steps: u32,
18 pub node_id: Option<String>,
20 pub prompt_id: String,
22}
23
24#[derive(Debug, Clone, PartialEq, Eq)]
26pub enum ComfyStatus {
27 Queued,
29 Running { node_id: String },
31 Progress { step: u32, total: u32 },
33 Completed,
35 Failed { error: String },
37}
38
39#[derive(Debug, Clone)]
41pub struct WsConfig {
42 pub reconnect_attempts: u32,
44 pub reconnect_delay: Duration,
46 pub message_timeout: Duration,
48 pub max_messages_per_prompt: usize,
50 pub max_total_messages: usize,
52}
53
54impl Default for WsConfig {
55 fn default() -> Self {
56 Self {
57 reconnect_attempts: 3,
58 reconnect_delay: Duration::from_secs(1),
59 message_timeout: Duration::from_secs(30),
60 max_messages_per_prompt: 10_000,
61 max_total_messages: 50_000,
62 }
63 }
64}
65
66#[derive(Debug, Clone)]
68pub struct DownloadLimits {
69 pub max_image_bytes: usize,
71 pub download_timeout: Duration,
73}
74
75impl Default for DownloadLimits {
76 fn default() -> Self {
77 Self {
78 max_image_bytes: 100 * 1024 * 1024,
79 download_timeout: Duration::from_secs(60),
80 }
81 }
82}
83
84#[derive(Debug, Clone, Serialize, Deserialize)]
86pub struct ImageRef {
87 pub filename: String,
88 pub subfolder: String,
89 pub img_type: String,
90}
91
92#[derive(Debug, Clone)]
94pub struct PromptHistory {
95 pub status: String,
96 pub completed: bool,
97 pub images: Vec<ImageRef>,
98}
99
100#[derive(Debug, Clone, Serialize, Deserialize)]
102pub struct QueueStatus {
103 pub running: u32,
104 pub pending: u32,
105}
106
107#[derive(Debug, Clone)]
109pub enum GenerationOutcome {
110 Completed { images: Vec<ImageRef> },
112 Failed { error: String },
114 TimedOut,
116}