diff --git a/apps/desktop/src-tauri/src/presentation/commands/outfit_search_commands.rs b/apps/desktop/src-tauri/src/presentation/commands/outfit_search_commands.rs index 85c9e98..956a573 100644 --- a/apps/desktop/src-tauri/src/presentation/commands/outfit_search_commands.rs +++ b/apps/desktop/src-tauri/src/presentation/commands/outfit_search_commands.rs @@ -5,7 +5,7 @@ use crate::app_state::AppState; use crate::data::models::gemini_analysis::{AnalyzeImageRequest, AnalyzeImageResponse}; use crate::data::models::outfit_search::{ LLMQueryRequest, LLMQueryResponse, OutfitSearchGlobalConfig, ProductInfo, SearchFilterBuilder, - SearchRequest, SearchResponse, SearchResult, SearchConfig, + SearchRequest, SearchResponse, SearchResult, }; use crate::data::models::outfit_recommendation::{ OutfitRecommendationRequest, OutfitRecommendationResponse, @@ -491,9 +491,8 @@ async fn execute_vertex_ai_search( crate::data::models::outfit_search::RelevanceThreshold::Low => "LOW", crate::data::models::outfit_search::RelevanceThreshold::Medium => "MEDIUM", crate::data::models::outfit_search::RelevanceThreshold::High => "HIGH", - crate::data::models::outfit_search::RelevanceThreshold::Unspecified => "RELEVANCE_THRESHOLD_UNSPECIFIED", }; - payload["relevanceThreshold"] = serde_json::Value::String(threshold_str.to_string()); + payload["relevanceThreshold"] = serde_json::Value::String(threshold_str.to_owned()); payload["relevanceScoreSpec"] = serde_json::json!({ "returnRelevanceScore": true }); @@ -655,7 +654,7 @@ async fn get_google_access_token() -> Result { /// 将 Vertex AI Search 响应转换为我们的搜索结果格式 fn convert_vertex_response_to_search_results( vertex_response: &serde_json::Value, - request: &SearchRequest, + _request: &SearchRequest, ) -> Result { let mut results = Vec::new(); @@ -670,8 +669,8 @@ fn convert_vertex_response_to_search_results( search_result.id, search_result.relevance_score ); - // 应用相关性阈值过滤 - let threshold = request.config.relevance_threshold.to_value(); + // 应用相关性阈值过滤(暂时跳过,直接添加结果) + // let _threshold = request.config.relevance_threshold; results.push(search_result); } else { eprintln!("解析搜索结果失败"); @@ -901,7 +900,7 @@ pub fn get_outfit_search_command_names() -> Vec<&'static str> { } /// 构建简化的过滤器字符串 - 参考Python实现 -fn build_simple_filters(config: &SearchConfig) -> String { +fn build_simple_filters(config: &crate::data::models::outfit_search::SearchConfig) -> String { let mut filters = Vec::new(); // 环境标签过滤 @@ -926,7 +925,7 @@ fn build_simple_filters(config: &SearchConfig) -> String { } /// 构建简化的查询字符串 - 参考Python实现 -fn build_simple_query(base_query: &str, config: &SearchConfig) -> String { +fn build_simple_query(base_query: &str, config: &crate::data::models::outfit_search::SearchConfig) -> String { if !config.query_enhancement_enabled { return base_query.to_string(); }