From a56336b63eca0e03916e74435e4f914f61382bad Mon Sep 17 00:00:00 2001 From: root Date: Fri, 11 Jul 2025 00:34:04 +0800 Subject: [PATCH] fix --- src-tauri/src/commands/resource_category.rs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src-tauri/src/commands/resource_category.rs b/src-tauri/src/commands/resource_category.rs index dc2a909..7ddc2b4 100644 --- a/src-tauri/src/commands/resource_category.rs +++ b/src-tauri/src/commands/resource_category.rs @@ -1,6 +1,6 @@ use serde::{Deserialize, Serialize}; use tauri::{command, AppHandle}; -use crate::python_executor::execute_python_command; +use crate::python_executor::{execute_python_command, PythonExecutorConfig}; #[derive(Debug, Serialize, Deserialize)] pub struct CreateCategoryRequest { @@ -20,10 +20,11 @@ pub struct UpdateCategoryRequest { #[command] pub async fn get_all_resource_categories(app: AppHandle) -> Result { let args = vec![ + "-m".to_string(), "python_core.services.resource_category_manager".to_string(), "get_all_categories".to_string(), ]; - + execute_python_command(app, &args, None).await } @@ -31,11 +32,12 @@ pub async fn get_all_resource_categories(app: AppHandle) -> Result Result { let args = vec![ + "-m".to_string(), "python_core.services.resource_category_manager".to_string(), "get_category_by_id".to_string(), category_id, ]; - + execute_python_command(app, &args, None).await } @@ -43,13 +45,14 @@ pub async fn get_resource_category_by_id(app: AppHandle, category_id: String) -> #[command] pub async fn create_resource_category(app: AppHandle, request: CreateCategoryRequest) -> Result { let args = vec![ + "-m".to_string(), "python_core.services.resource_category_manager".to_string(), "create_category".to_string(), request.title, request.ai_prompt, request.color, ]; - + execute_python_command(app, &args, None).await } @@ -62,14 +65,15 @@ pub async fn update_resource_category( ) -> Result { let request_json = serde_json::to_string(&request) .map_err(|e| format!("Failed to serialize request: {}", e))?; - + let args = vec![ + "-m".to_string(), "python_core.services.resource_category_manager".to_string(), "update_category".to_string(), category_id, request_json, ]; - + execute_python_command(app, &args, None).await } @@ -77,11 +81,12 @@ pub async fn update_resource_category( #[command] pub async fn delete_resource_category(app: AppHandle, category_id: String) -> Result { let args = vec![ + "-m".to_string(), "python_core.services.resource_category_manager".to_string(), "delete_category".to_string(), category_id, ]; - + execute_python_command(app, &args, None).await }