fix: cargo check --lib error
This commit is contained in:
parent
e69ce2b817
commit
13e7d640e3
|
|
@ -19,6 +19,9 @@ use crate::data::models::comfyui::{
|
|||
WorkflowModel, TemplateModel, ExecutionModel, ExecutionStatus,
|
||||
ExecuteWorkflowRequest
|
||||
};
|
||||
use crate::presentation::commands::comfyui_v2_commands::{
|
||||
CreateWorkflowRequest, UpdateWorkflowRequest, CreateTemplateRequest, ExecuteTemplateRequest
|
||||
};
|
||||
use crate::data::repositories::comfyui_repository::ComfyUIRepository;
|
||||
use crate::business::services::realtime_monitor_v2::RealtimeMonitorV2;
|
||||
use crate::business::services::queue_manager::QueueManager;
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ use crate::business::services::{
|
|||
comfyui_manager::ComfyUIManager,
|
||||
};
|
||||
use crate::data::repositories::comfyui_repository::ComfyUIRepository;
|
||||
use crate::data::models::comfyui::ComfyUIConfig;
|
||||
|
||||
/// ComfyUI V2 服务管理器
|
||||
/// 负责管理所有 ComfyUI V2 相关服务的生命周期
|
||||
|
|
@ -39,12 +40,23 @@ pub struct ComfyUIV2ServiceManager {
|
|||
|
||||
impl ComfyUIV2ServiceManager {
|
||||
/// 创建新的服务管理器
|
||||
pub fn new(repository: Arc<ComfyUIRepository>) -> Self {
|
||||
pub fn new(repository: Arc<ComfyUIRepository>) -> Result<Self> {
|
||||
// 创建缓存管理器
|
||||
let cache_manager = Arc::new(CacheManager::new(CacheConfig::default()));
|
||||
|
||||
// 创建 ComfyUI 管理器
|
||||
let comfyui_manager = Arc::new(ComfyUIManager::new(repository.clone()));
|
||||
// 创建 ComfyUI 管理器 - 使用默认配置
|
||||
let default_config = ComfyUIConfig {
|
||||
base_url: "http://127.0.0.1:8188".to_string(),
|
||||
timeout_seconds: 30,
|
||||
retry_attempts: 3,
|
||||
retry_delay_ms: 1000,
|
||||
enable_websocket: true,
|
||||
enable_cache: true,
|
||||
max_concurrency: 10,
|
||||
custom_headers: None,
|
||||
};
|
||||
let comfyui_manager = Arc::new(ComfyUIManager::new(default_config)?);
|
||||
let comfyui_manager_result = comfyui_manager;
|
||||
|
||||
// 创建模板引擎
|
||||
let template_engine = Arc::new(TemplateEngine::new(repository.clone()));
|
||||
|
|
@ -54,7 +66,7 @@ impl ComfyUIV2ServiceManager {
|
|||
|
||||
// 创建实时监控服务
|
||||
let realtime_monitor = Arc::new(RealtimeMonitorV2::new(
|
||||
comfyui_manager.clone(),
|
||||
comfyui_manager_result.clone(),
|
||||
repository.clone(),
|
||||
None
|
||||
));
|
||||
|
|
@ -67,7 +79,7 @@ impl ComfyUIV2ServiceManager {
|
|||
template_engine.clone(),
|
||||
));
|
||||
|
||||
Self {
|
||||
Ok(Self {
|
||||
repository,
|
||||
comfyui_service,
|
||||
realtime_monitor,
|
||||
|
|
@ -76,7 +88,7 @@ impl ComfyUIV2ServiceManager {
|
|||
template_engine,
|
||||
initialized: Arc::new(RwLock::new(false)),
|
||||
running: Arc::new(RwLock::new(false)),
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/// 初始化所有服务
|
||||
|
|
|
|||
|
|
@ -22,9 +22,47 @@ use crate::data::models::comfyui::{
|
|||
ParameterValues, ValidationResult,
|
||||
};
|
||||
use comfyui_sdk::types::{ComfyUIWorkflow, ComfyUINode};
|
||||
use std::collections::HashMap;
|
||||
use crate::business::services::comfyui_manager::ComfyUIManager;
|
||||
|
||||
// ==================== 请求类型定义 ====================
|
||||
|
||||
/// 创建工作流请求
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct CreateWorkflowRequest {
|
||||
pub name: String,
|
||||
pub description: Option<String>,
|
||||
pub workflow_json: serde_json::Value,
|
||||
pub tags: Option<Vec<String>>,
|
||||
}
|
||||
|
||||
/// 更新工作流请求
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct UpdateWorkflowRequest {
|
||||
pub id: String,
|
||||
pub name: Option<String>,
|
||||
pub description: Option<String>,
|
||||
pub workflow_json: Option<serde_json::Value>,
|
||||
pub tags: Option<Vec<String>>,
|
||||
}
|
||||
|
||||
/// 创建模板请求
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct CreateTemplateRequest {
|
||||
pub name: String,
|
||||
pub description: Option<String>,
|
||||
pub template_json: serde_json::Value,
|
||||
pub parameters: Option<serde_json::Value>,
|
||||
pub tags: Option<Vec<String>>,
|
||||
}
|
||||
|
||||
/// 执行模板请求
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct ExecuteTemplateRequest {
|
||||
pub template_id: String,
|
||||
pub parameters: serde_json::Value,
|
||||
pub priority: Option<u32>,
|
||||
}
|
||||
|
||||
// ==================== 响应类型定义 ====================
|
||||
|
||||
/// 连接状态响应
|
||||
|
|
@ -359,28 +397,6 @@ fn convert_queue_status(status: comfyui_sdk::types::QueueStatus) -> QueueStatusR
|
|||
|
||||
// ==================== 工作流管理命令 ====================
|
||||
|
||||
/// 工作流创建请求
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct CreateWorkflowRequest {
|
||||
pub name: String,
|
||||
pub description: Option<String>,
|
||||
pub workflow_data: HashMap<String, serde_json::Value>,
|
||||
pub category: Option<String>,
|
||||
pub tags: Vec<String>,
|
||||
}
|
||||
|
||||
/// 工作流更新请求
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct UpdateWorkflowRequest {
|
||||
pub id: String,
|
||||
pub name: Option<String>,
|
||||
pub description: Option<String>,
|
||||
pub workflow_data: Option<HashMap<String, serde_json::Value>>,
|
||||
pub category: Option<String>,
|
||||
pub tags: Option<Vec<String>>,
|
||||
pub enabled: Option<bool>,
|
||||
}
|
||||
|
||||
/// 工作流响应
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct WorkflowResponse {
|
||||
|
|
|
|||
Loading…
Reference in New Issue