feat: refine tool UI and result actions

This commit is contained in:
2026-04-24 18:11:12 +08:00
parent 6064b1c809
commit 8254994df8
5 changed files with 895 additions and 425 deletions

View File

@@ -0,0 +1,24 @@
use tauri::{AppHandle, Manager};
use tauri_plugin_opener::OpenerExt;
#[tauri::command]
pub async fn reveal_path(app: AppHandle, path: String) -> Result<(), String> {
app.opener()
.reveal_item_in_dir(path)
.map_err(|error| error.to_string())
}
#[tauri::command]
pub async fn open_generated_dir(app: AppHandle) -> Result<(), String> {
let dir = app
.path()
.app_data_dir()
.map_err(|error| error.to_string())?
.join("images")
.join("generated");
std::fs::create_dir_all(&dir).map_err(|error| error.to_string())?;
app.opener()
.open_path(dir.to_string_lossy().to_string(), None::<&str>)
.map_err(|error| error.to_string())
}

View File

@@ -1,3 +1,4 @@
pub mod dialog;
pub mod file;
pub mod generation;
pub mod provider;

View File

@@ -54,6 +54,8 @@ pub fn run() {
commands::provider::upsert_provider,
commands::provider::delete_provider,
commands::dialog::pick_material_images,
commands::file::reveal_path,
commands::file::open_generated_dir,
commands::generation::create_generation_task,
commands::generation::generate_image,
])