diff --git a/apps/desktop/src-tauri/src/business/services/batch_watermark_processor.rs b/apps/desktop/src-tauri/src/business/services/batch_watermark_processor.rs index 9d45211..4efc531 100644 --- a/apps/desktop/src-tauri/src/business/services/batch_watermark_processor.rs +++ b/apps/desktop/src-tauri/src/business/services/batch_watermark_processor.rs @@ -28,7 +28,7 @@ impl BatchWatermarkProcessor { task: BatchWatermarkTask, repository: Arc, ) -> Result<()> { - let timer = PERFORMANCE_MONITOR.start_operation("batch_watermark_processing"); + let _timer = PERFORMANCE_MONITOR.start_operation("batch_watermark_processing"); let start_time = Instant::now(); info!( @@ -343,7 +343,7 @@ impl BatchWatermarkProcessor { /// 保存检测结果 async fn save_detection_result( result: &crate::data::models::watermark::WatermarkDetectionResult, - repository: &MaterialRepository, + _repository: &MaterialRepository, ) -> Result<()> { // TODO: 实现检测结果保存逻辑 debug!( @@ -386,7 +386,7 @@ impl BatchWatermarkProcessor { } /// 从配置中获取水印路径 - fn get_watermark_path_from_config(config: &WatermarkConfig) -> Result { + fn get_watermark_path_from_config(_config: &WatermarkConfig) -> Result { // TODO: 根据水印类型和配置获取实际的水印文件路径 // 这里需要与水印模板管理系统集成 Ok("watermarks/default.png".to_string()) diff --git a/apps/desktop/src-tauri/src/business/services/conversation_service.rs b/apps/desktop/src-tauri/src/business/services/conversation_service.rs index d82ade6..8717378 100644 --- a/apps/desktop/src-tauri/src/business/services/conversation_service.rs +++ b/apps/desktop/src-tauri/src/business/services/conversation_service.rs @@ -139,7 +139,7 @@ impl ConversationService { gemini_service: &mut GeminiService, current_message: &str, history_messages: &[ConversationMessage], - system_prompt: Option<&str>, + _system_prompt: Option<&str>, ) -> Result { use crate::infrastructure::gemini_service::{GenerateContentRequest, ContentPart, Part, GenerationConfig}; diff --git a/apps/desktop/src-tauri/src/business/services/material_matching_service.rs b/apps/desktop/src-tauri/src/business/services/material_matching_service.rs index 26b9769..abc386e 100644 --- a/apps/desktop/src-tauri/src/business/services/material_matching_service.rs +++ b/apps/desktop/src-tauri/src/business/services/material_matching_service.rs @@ -812,7 +812,7 @@ impl MaterialMatchingService { used_segment_ids: &mut HashSet, template_already_used_sequence_001: bool, ) -> Result { - let target_duration = track_segment.duration as f64 / 1_000_000.0; // 转换为秒 + let _target_duration = track_segment.duration as f64 / 1_000_000.0; // 转换为秒 // 获取所有AI分类,按权重排序 let ai_classifications = match self.ai_classification_service.get_classifications_by_weight().await { @@ -933,9 +933,9 @@ impl MaterialMatchingService { // 开始循环匹配 loop { total_rounds += 1; - let round_start_time = std::time::Instant::now(); + let _round_start_time = std::time::Instant::now(); let mut round_successful_matches = 0u32; - let mut round_failed_matches = 0u32; + let mut _round_failed_matches = 0u32; // 记录本轮开始时的已使用片段数量,用于检测是否有实质性进展 let segments_count_before_round = global_used_segment_ids.len(); @@ -1027,7 +1027,7 @@ impl MaterialMatchingService { }); } else { // 部分匹配失败,视为失败 - round_failed_matches += 1; + _round_failed_matches += 1; failed_matches += 1; let failure_reason = format!("部分匹配失败:{} 个片段匹配成功,{} 个片段匹配失败", @@ -1052,7 +1052,7 @@ impl MaterialMatchingService { } } Err(error) => { - round_failed_matches += 1; + _round_failed_matches += 1; failed_matches += 1; matching_results.push(BatchMatchingItemResult { diff --git a/apps/desktop/src-tauri/src/business/services/tests/template_foreign_key_test.rs b/apps/desktop/src-tauri/src/business/services/tests/template_foreign_key_test.rs index 8a1614d..8023d3e 100644 --- a/apps/desktop/src-tauri/src/business/services/tests/template_foreign_key_test.rs +++ b/apps/desktop/src-tauri/src/business/services/tests/template_foreign_key_test.rs @@ -127,7 +127,7 @@ mod template_foreign_key_tests { #[tokio::test] async fn test_template_id_consistency() { let database = create_test_database(); - let service = TemplateService::new(database); + let _service = TemplateService::new(database); let template = create_test_template(); // 验证模板和素材的ID一致性 diff --git a/apps/desktop/src-tauri/src/business/services/tests/watermark_tests.rs b/apps/desktop/src-tauri/src/business/services/tests/watermark_tests.rs index f084479..b257bfc 100644 --- a/apps/desktop/src-tauri/src/business/services/tests/watermark_tests.rs +++ b/apps/desktop/src-tauri/src/business/services/tests/watermark_tests.rs @@ -208,10 +208,6 @@ mod watermark_tests { #[test] fn test_watermark_position_calculation() { - let video_width = 1920.0; - let video_height = 1080.0; - let scale = 1.0; - // 测试固定位置 let positions = vec![ WatermarkPosition::TopLeft, diff --git a/apps/desktop/src-tauri/src/business/services/watermark_addition_service.rs b/apps/desktop/src-tauri/src/business/services/watermark_addition_service.rs index 335eb4f..580ddef 100644 --- a/apps/desktop/src-tauri/src/business/services/watermark_addition_service.rs +++ b/apps/desktop/src-tauri/src/business/services/watermark_addition_service.rs @@ -25,9 +25,9 @@ impl WatermarkAdditionService { output_path: &str, watermark_path: &str, config: &WatermarkConfig, - repository: Arc, + _repository: Arc, ) -> Result { - let timer = PERFORMANCE_MONITOR.start_operation("watermark_addition_video"); + let _timer = PERFORMANCE_MONITOR.start_operation("watermark_addition_video"); let start_time = Instant::now(); info!( @@ -139,7 +139,7 @@ impl WatermarkAdditionService { watermark_path: &str, config: &WatermarkConfig, ) -> Result { - let timer = PERFORMANCE_MONITOR.start_operation("watermark_addition_image"); + let _timer = PERFORMANCE_MONITOR.start_operation("watermark_addition_image"); let start_time = Instant::now(); info!( @@ -597,7 +597,7 @@ impl WatermarkAdditionService { opacity: f32, scale: f32, rotation: f32, - blend_mode: &BlendMode, + _blend_mode: &BlendMode, animation: Option<&WatermarkAnimation>, ) -> String { let mut filter_parts = Vec::new(); @@ -652,7 +652,7 @@ impl WatermarkAdditionService { position: &(f32, f32), opacity: f32, scale: f32, - rotation: f32, + _rotation: f32, ) -> String { let font_size = (24.0 * scale) as u32; let alpha = (opacity * 255.0) as u32; @@ -693,7 +693,7 @@ impl WatermarkAdditionService { } /// 转换SVG为PNG - async fn convert_svg_to_png(svg_path: &str, scale: f32) -> Result { + async fn convert_svg_to_png(svg_path: &str, _scale: f32) -> Result { // TODO: 实现SVG到PNG的转换 // 可以使用librsvg或其他SVG渲染库 diff --git a/apps/desktop/src-tauri/src/business/services/watermark_detection_service.rs b/apps/desktop/src-tauri/src/business/services/watermark_detection_service.rs index c7859a6..bb29b6e 100644 --- a/apps/desktop/src-tauri/src/business/services/watermark_detection_service.rs +++ b/apps/desktop/src-tauri/src/business/services/watermark_detection_service.rs @@ -22,9 +22,9 @@ impl WatermarkDetectionService { material_id: &str, video_path: &str, config: &WatermarkDetectionConfig, - repository: Arc, + _repository: Arc, ) -> Result { - let timer = PERFORMANCE_MONITOR.start_operation("watermark_detection"); + let _timer = PERFORMANCE_MONITOR.start_operation("watermark_detection"); let start_time = Instant::now(); info!( @@ -142,7 +142,7 @@ impl WatermarkDetectionService { image_path: &str, config: &WatermarkDetectionConfig, ) -> Result { - let timer = PERFORMANCE_MONITOR.start_operation("watermark_detection_image"); + let _timer = PERFORMANCE_MONITOR.start_operation("watermark_detection_image"); let start_time = Instant::now(); info!( @@ -306,7 +306,7 @@ impl WatermarkDetectionService { /// 模板匹配检测 async fn template_matching_detection( image_path: &str, - config: &WatermarkDetectionConfig, + _config: &WatermarkDetectionConfig, ) -> Result> { // TODO: 实现OpenCV模板匹配算法 // 这里先返回模拟结果,后续需要集成OpenCV @@ -334,7 +334,7 @@ impl WatermarkDetectionService { /// 边缘检测 async fn edge_detection( image_path: &str, - config: &WatermarkDetectionConfig, + _config: &WatermarkDetectionConfig, ) -> Result> { // TODO: 实现边缘检测算法 debug!("执行边缘检测: {}", image_path); @@ -346,7 +346,7 @@ impl WatermarkDetectionService { /// 频域分析检测 async fn frequency_analysis_detection( image_path: &str, - config: &WatermarkDetectionConfig, + _config: &WatermarkDetectionConfig, ) -> Result> { // TODO: 实现频域分析算法 debug!("执行频域分析检测: {}", image_path); @@ -358,7 +358,7 @@ impl WatermarkDetectionService { /// 透明度检测 async fn transparency_detection( image_path: &str, - config: &WatermarkDetectionConfig, + _config: &WatermarkDetectionConfig, ) -> Result> { // TODO: 实现透明度检测算法 debug!("执行透明度检测: {}", image_path); diff --git a/apps/desktop/src-tauri/src/business/services/watermark_removal_service.rs b/apps/desktop/src-tauri/src/business/services/watermark_removal_service.rs index b0255e9..34ab893 100644 --- a/apps/desktop/src-tauri/src/business/services/watermark_removal_service.rs +++ b/apps/desktop/src-tauri/src/business/services/watermark_removal_service.rs @@ -23,9 +23,9 @@ impl WatermarkRemovalService { input_path: &str, output_path: &str, config: &WatermarkRemovalConfig, - repository: Arc, + _repository: Arc, ) -> Result { - let timer = PERFORMANCE_MONITOR.start_operation("watermark_removal_video"); + let _timer = PERFORMANCE_MONITOR.start_operation("watermark_removal_video"); let start_time = Instant::now(); info!( @@ -117,7 +117,7 @@ impl WatermarkRemovalService { output_path: &str, config: &WatermarkRemovalConfig, ) -> Result { - let timer = PERFORMANCE_MONITOR.start_operation("watermark_removal_image"); + let _timer = PERFORMANCE_MONITOR.start_operation("watermark_removal_image"); let start_time = Instant::now(); info!( diff --git a/apps/desktop/src-tauri/src/business/services/watermark_template_service.rs b/apps/desktop/src-tauri/src/business/services/watermark_template_service.rs index 5f1ebb4..d205b47 100644 --- a/apps/desktop/src-tauri/src/business/services/watermark_template_service.rs +++ b/apps/desktop/src-tauri/src/business/services/watermark_template_service.rs @@ -27,7 +27,7 @@ impl WatermarkTemplateService { description: Option, tags: Vec, ) -> Result { - let timer = PERFORMANCE_MONITOR.start_operation("upload_watermark_template"); + let _timer = PERFORMANCE_MONITOR.start_operation("upload_watermark_template"); let start_time = Instant::now(); info!( @@ -165,7 +165,7 @@ impl WatermarkTemplateService { info!(template_id = %template_id, hard_delete = hard_delete, "开始删除水印模板"); // 获取模板信息 - let template = repository.get_by_id(&template_id)? + let _template = repository.get_by_id(&template_id)? .ok_or_else(|| anyhow!("模板不存在: {}", template_id))?; if hard_delete { @@ -297,7 +297,7 @@ impl WatermarkTemplateService { } /// 生成文字水印缩略图 - fn generate_text_thumbnail(text_file_path: &str, output_path: &str) -> Result<()> { + fn generate_text_thumbnail(_text_file_path: &str, output_path: &str) -> Result<()> { // TODO: 实现文字水印缩略图生成 // 可以使用图像库生成包含文字的预览图 diff --git a/apps/desktop/src-tauri/src/presentation/commands/similarity_search_commands.rs b/apps/desktop/src-tauri/src/presentation/commands/similarity_search_commands.rs index c60c467..aececd5 100644 --- a/apps/desktop/src-tauri/src/presentation/commands/similarity_search_commands.rs +++ b/apps/desktop/src-tauri/src/presentation/commands/similarity_search_commands.rs @@ -1,5 +1,5 @@ use tauri::{command, State}; -use crate::infrastructure::app_state::AppState; +use crate::app_state::AppState; use crate::data::models::outfit_search::{SearchRequest, SearchResponse, SearchConfig, RelevanceThreshold}; use crate::presentation::commands::outfit_search_commands::search_similar_outfits; @@ -74,13 +74,14 @@ pub async fn get_similarity_search_suggestions( // 基于查询过滤建议 let filtered_suggestions: Vec = base_suggestions - .into_iter() + .iter() .filter(|suggestion| { - suggestion.contains(&query) || + suggestion.contains(&query) || query.chars().any(|c| suggestion.contains(c)) }) + .cloned() .collect(); - + // 如果没有匹配的建议,返回基础建议的前几个 if filtered_suggestions.is_empty() { Ok(base_suggestions.into_iter().take(6).collect())