From 3f3e5d577cabc0fcd3ddbaa196f457009c709d5a Mon Sep 17 00:00:00 2001 From: hummel mao Date: Wed, 3 Sep 2025 18:40:42 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix(command):=20=E4=BF=AE=E5=A4=8D=20layout?= =?UTF-8?q?=20error=20=E4=B8=8D=E8=83=BD=E8=BD=AC=E6=8D=A2=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ModelVis/app/src-tauri/src/commands.rs | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/plugins/mindstudio-insight-plugins/ModelVis/app/src-tauri/src/commands.rs b/plugins/mindstudio-insight-plugins/ModelVis/app/src-tauri/src/commands.rs index 4a80e78a4..3a6a706bd 100644 --- a/plugins/mindstudio-insight-plugins/ModelVis/app/src-tauri/src/commands.rs +++ b/plugins/mindstudio-insight-plugins/ModelVis/app/src-tauri/src/commands.rs @@ -14,6 +14,7 @@ use csv_parser::operator::OperatorGroup; use csv_parser::parse_operator_csv; use path_validator::{FileErrorKind, FileExt}; use crate::errors::{app_error::AppResult, convert::convert_error, fsg::FSGErrorEnum}; +use crate::errors::app_error::AppError; #[allow(non_snake_case)] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -202,8 +203,18 @@ pub struct GraphLayer { #[tauri::command] pub fn layout_bin(handle: AppHandle, path: String) -> AppResult { - let script_path = handle.path().resolve("resources/bin.ts", BaseDirectory::Resource)?; - + let resolve_result = handle.path().resolve("resources/bin.ts", BaseDirectory::Resource); + let script_path; + match resolve_result { + Ok(p) => { script_path = p } + Err(error) => { return Err(AppError::Anyhow { + code: 9999, // 通用内部错误码 + message_en: "An internal error occurred".to_string(), + message_cn: "发生内部错误".to_string(), + backtrace: error.to_string(), + }); } + } + let s1 = Instant::now(); check_path(&path)?; let model = parse_bin(&path)?; @@ -211,7 +222,16 @@ pub fn layout_bin(handle: AppHandle, path: String) -> AppResult { let tmp_folder = home_dir().unwrap().join(".llm_visual"); if !tmp_folder.exists() { - create_dir_750(&tmp_folder)?; + let result = create_dir_750(&tmp_folder); + match result { + Ok(_) => { /* do nothing */ } + Err(error) => { return Err(AppError::Anyhow { + code: 9999, // 通用内部错误码 + message_en: "An internal error occurred".to_string(), + message_cn: "发生内部错误".to_string(), + backtrace: error.to_string(), + }); } + } } let dst = tmp_folder.join("rs.json"); let s2 = Instant::now(); -- Gitee From 24d5053b57da50c31cfdcf8daa514fa1ddc84e95 Mon Sep 17 00:00:00 2001 From: hummel mao Date: Thu, 4 Sep 2025 14:47:17 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix(command):=20=E6=A3=80=E8=A7=86=E6=84=8F?= =?UTF-8?q?=E8=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ModelVis/app/src-tauri/src/commands.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins/mindstudio-insight-plugins/ModelVis/app/src-tauri/src/commands.rs b/plugins/mindstudio-insight-plugins/ModelVis/app/src-tauri/src/commands.rs index 3a6a706bd..a5c083374 100644 --- a/plugins/mindstudio-insight-plugins/ModelVis/app/src-tauri/src/commands.rs +++ b/plugins/mindstudio-insight-plugins/ModelVis/app/src-tauri/src/commands.rs @@ -208,9 +208,9 @@ pub fn layout_bin(handle: AppHandle, path: String) -> AppResult { match resolve_result { Ok(p) => { script_path = p } Err(error) => { return Err(AppError::Anyhow { - code: 9999, // 通用内部错误码 - message_en: "An internal error occurred".to_string(), - message_cn: "发生内部错误".to_string(), + code: 9999, // 临时使用通用内部错误码 + message_en: "Load resources fail".to_string(), + message_cn: "加载资源失败".to_string(), backtrace: error.to_string(), }); } } @@ -226,9 +226,9 @@ pub fn layout_bin(handle: AppHandle, path: String) -> AppResult { match result { Ok(_) => { /* do nothing */ } Err(error) => { return Err(AppError::Anyhow { - code: 9999, // 通用内部错误码 - message_en: "An internal error occurred".to_string(), - message_cn: "发生内部错误".to_string(), + code: 9999, // 临时使用通用内部错误码 + message_en: "Create .llm_visual directory fail".to_string(), + message_cn: "创建 .llm_visual 文件夹失败".to_string(), backtrace: error.to_string(), }); } } -- Gitee