From 346762499e05657b74fca0cf7e3fd71e02455bef Mon Sep 17 00:00:00 2001 From: root Date: Fri, 11 Jul 2025 12:00:08 +0800 Subject: [PATCH] fix: command --- src-tauri/src/commands/project.rs | 21 ++++++++------------- src-tauri/src/lib.rs | 3 +++ 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src-tauri/src/commands/project.rs b/src-tauri/src/commands/project.rs index 4455699..a663327 100644 --- a/src-tauri/src/commands/project.rs +++ b/src-tauri/src/commands/project.rs @@ -51,24 +51,19 @@ pub async fn get_project_info(project_path: String) -> Result Result { - let args = serde_json::json!({ - "project_id": project_id - }); - execute_python_command("project_manager", "get_project_by_id", Some(args)).await -} /// 扫描目录文件 #[command] -pub async fn scan_directory(directory_path: String) -> Result { - let args = serde_json::json!({ - "directory_path": directory_path - }); +pub async fn scan_directory(app: AppHandle, directory_path: String) -> Result { + let args = vec![ + "-m".to_string(), + "python_core.services.file_manager".to_string(), + "scan_directory".to_string(), + directory_path, + ]; - execute_python_command("file_manager", "scan_directory", Some(args)).await + execute_python_command(app, &args, None).await } /// 在系统中打开文件 diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 13a978d..0989946 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -56,6 +56,9 @@ pub fn run() { commands::delete_project, commands::search_projects, commands::open_project_directory, + commands::project::scan_directory, + commands::project::open_file_in_system, + commands::project::delete_file, commands::model::get_all_models, commands::model::get_model_by_id, commands::model::create_model,