feat: polish workflow studio and workspace assets

This commit is contained in:
boos
2026-05-25 20:42:38 +08:00
parent cb35d5fc6e
commit 1ba293c262
29 changed files with 2299 additions and 158 deletions
+41
View File
@@ -52,6 +52,12 @@ pub struct ProxyConfig {
#[derive(Debug, Deserialize, Clone)]
pub struct ComfyUIConfig {
pub enabled: bool,
#[serde(default)]
pub backend: ComfyUIBackend,
#[serde(default = "default_comfyui_docker_image")]
pub docker_image: String,
#[serde(default = "default_comfyui_container_name")]
pub container_name: String,
pub install_dir: Option<PathBuf>,
pub python_bin: String,
pub port: u16,
@@ -59,13 +65,35 @@ pub struct ComfyUIConfig {
pub max_restarts: u32,
pub external_url: Option<String>,
pub base_url: Option<String>,
pub api_key: Option<String>,
pub agent_model: String,
}
#[derive(Debug, Deserialize, Clone, Default)]
#[serde(rename_all = "snake_case")]
pub enum ComfyUIBackend {
#[default]
Boosapi,
External,
Cloud,
Docker,
}
fn default_comfyui_docker_image() -> String {
"boosapi-comfyui:multi-tenant".to_string()
}
fn default_comfyui_container_name() -> String {
"boosapi-comfyui-workflow".to_string()
}
impl Default for ComfyUIConfig {
fn default() -> Self {
Self {
enabled: false,
backend: ComfyUIBackend::Boosapi,
docker_image: default_comfyui_docker_image(),
container_name: default_comfyui_container_name(),
install_dir: None,
python_bin: "python3".to_string(),
port: 8188,
@@ -73,12 +101,25 @@ impl Default for ComfyUIConfig {
max_restarts: 5,
external_url: None,
base_url: Some("http://127.0.0.1:8188".to_string()),
api_key: None,
agent_model: "gpt-4o".to_string(),
}
}
}
impl ComfyUIConfig {
pub fn uses_native_backend(&self) -> bool {
matches!(self.backend, ComfyUIBackend::External | ComfyUIBackend::Cloud)
}
pub fn uses_cloud_backend(&self) -> bool {
matches!(self.backend, ComfyUIBackend::Cloud)
}
pub fn uses_docker_backend(&self) -> bool {
matches!(self.backend, ComfyUIBackend::Docker)
}
pub fn target_base_url(&self) -> String {
self.external_url
.as_deref()