diff --git a/apps/desktop/src-tauri/src/presentation/commands/tvai_commands.rs b/apps/desktop/src-tauri/src/presentation/commands/tvai_commands.rs index 6865fe2..49eaaea 100644 --- a/apps/desktop/src-tauri/src/presentation/commands/tvai_commands.rs +++ b/apps/desktop/src-tauri/src/presentation/commands/tvai_commands.rs @@ -198,6 +198,7 @@ pub async fn quick_upscale_video_command( input_path: String, output_path: String, scale_factor: f32, + model: Option, ) -> Result { let task_id = Uuid::new_v4().to_string(); @@ -242,12 +243,38 @@ pub async fn quick_upscale_video_command( app_handle_clone.emit("tvai_task_updated", &task_id_clone).unwrap(); let start_time = std::time::Instant::now(); - + + // 解析模型参数 + let upscale_model = if let Some(model_str) = model { + match model_str.as_str() { + "aaa-9" => Some(UpscaleModel::Aaa9), + "ahq-12" => Some(UpscaleModel::Ahq12), + "alq-13" => Some(UpscaleModel::Alq13), + "alqs-2" => Some(UpscaleModel::Alqs2), + "amq-13" => Some(UpscaleModel::Amq13), + "amqs-2" => Some(UpscaleModel::Amqs2), + "ghq-5" => Some(UpscaleModel::Ghq5), + "iris-2" => Some(UpscaleModel::Iris2), + "iris-3" => Some(UpscaleModel::Iris3), + "nyx-3" => Some(UpscaleModel::Nyx3), + "prob-4" => Some(UpscaleModel::Prob4), + "thf-4" => Some(UpscaleModel::Thf4), + "thd-3" => Some(UpscaleModel::Thd3), + "thm-2" => Some(UpscaleModel::Thm2), + "rhea-1" => Some(UpscaleModel::Rhea1), + "rxl-1" => Some(UpscaleModel::Rxl1), + _ => None, // 使用默认模型 + } + } else { + None // 使用默认模型 + }; + // 执行处理 - let result = quick_upscale_video( + let result = tvai::quick_upscale_video_with_model( Path::new(&input_path), Path::new(&output_path), scale_factor, + upscale_model, ).await; let processing_time = start_time.elapsed(); diff --git a/apps/desktop/src/components/TvaiExample.tsx b/apps/desktop/src/components/TvaiExample.tsx index b2e1bf9..7a94735 100644 --- a/apps/desktop/src/components/TvaiExample.tsx +++ b/apps/desktop/src/components/TvaiExample.tsx @@ -38,6 +38,7 @@ export function TvaiExample() { // 高级参数 const [selectedModel, setSelectedModel] = useState('iris-3'); + const [selectedInterpolationModel, setSelectedInterpolationModel] = useState<'apo-8' | 'apf-1' | 'chr-2' | 'chf-3'>('apo-8'); const [compression, setCompression] = useState(0.0); const [blend, setBlend] = useState(0.0); @@ -112,7 +113,7 @@ export function TvaiExample() { try { if (processingType === 'video') { - await tvaiService.quickUpscaleVideo(inputPath, outputPath, scaleFactor); + await tvaiService.quickUpscaleVideo(inputPath, outputPath, scaleFactor, selectedModel); } else if (processingType === 'interpolation') { // 插帧处理 - 需要先获取视频信息来确定帧率 try { @@ -396,7 +397,7 @@ export function TvaiExample() { key={preset.key} onClick={() => { setSelectedPreset(preset.key); - setSelectedModel(preset.model as UpscaleModel); + setSelectedInterpolationModel(preset.model as 'apo-8' | 'apf-1' | 'chr-2' | 'chf-3'); }} className={`p-3 rounded-lg border text-sm transition-all ${ selectedPreset === preset.key @@ -463,8 +464,14 @@ export function TvaiExample() { {processingType === 'interpolation' ? '插帧模型' : 'AI 放大模型'}