From 5f1ba86ac26084feddfb50e8add1589ac7d605c0 Mon Sep 17 00:00:00 2001 From: xintaofei Date: Sun, 29 Mar 2026 21:43:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src-tauri/src/parsers/cline.rs | 6 +++--- src-tauri/src/web/event_bridge.rs | 6 ++++++ src-tauri/src/web/handlers/acp.rs | 8 ++++---- src-tauri/src/web/mod.rs | 6 ++++++ 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src-tauri/src/parsers/cline.rs b/src-tauri/src/parsers/cline.rs index e78567e..8741199 100644 --- a/src-tauri/src/parsers/cline.rs +++ b/src-tauri/src/parsers/cline.rs @@ -170,7 +170,7 @@ impl AgentParser for ClineParser { id: entry.id, agent_type: AgentType::Cline, folder_path, - folder_name: folder_name.map(String::from), + folder_name, title, started_at, ended_at, @@ -321,7 +321,7 @@ impl AgentParser for ClineParser { id: conversation_id.to_string(), agent_type: AgentType::Cline, folder_path, - folder_name: folder_name.map(String::from), + folder_name, title, started_at, ended_at, @@ -451,7 +451,7 @@ fn parse_tool_result_text(text: &str) -> (String, String, bool) { let tool_name = trimmed .strip_prefix('[') .and_then(|s| { - s.find(|c: char| c == ']' || c == ' ') + s.find([']', ' ']) .map(|i| s[..i].to_string()) }) .unwrap_or_default(); diff --git a/src-tauri/src/web/event_bridge.rs b/src-tauri/src/web/event_bridge.rs index f6d12a5..df42cdd 100644 --- a/src-tauri/src/web/event_bridge.rs +++ b/src-tauri/src/web/event_bridge.rs @@ -13,6 +13,12 @@ pub struct WebEventBroadcaster { sender: broadcast::Sender, } +impl Default for WebEventBroadcaster { + fn default() -> Self { + Self::new() + } +} + impl WebEventBroadcaster { pub fn new() -> Self { let (sender, _) = broadcast::channel(4096); diff --git a/src-tauri/src/web/handlers/acp.rs b/src-tauri/src/web/handlers/acp.rs index 4d69565..c917e06 100644 --- a/src-tauri/src/web/handlers/acp.rs +++ b/src-tauri/src/web/handlers/acp.rs @@ -390,7 +390,7 @@ pub async fn acp_update_agent_preferences( params.opencode_auth_json, params.codex_auth_json, params.codex_config_toml, - &db, + db, &emitter, ) .await @@ -437,7 +437,7 @@ pub async fn acp_prepare_npx_agent( let result = acp_commands::acp_prepare_npx_agent_core( params.agent_type, params.registry_version, - &db, + db, &emitter, ) .await @@ -451,7 +451,7 @@ pub async fn acp_uninstall_agent( ) -> Result, AppCommandError> { let db = &state.db; let emitter = state.emitter.clone(); - acp_commands::acp_uninstall_agent_core(params.agent_type, &db, &emitter) + acp_commands::acp_uninstall_agent_core(params.agent_type, db, &emitter) .await .map_err(|e| AppCommandError::task_execution_failed(e.to_string()))?; Ok(Json(())) @@ -469,7 +469,7 @@ pub async fn acp_reorder_agents( ) -> Result, AppCommandError> { let db = &state.db; let emitter = state.emitter.clone(); - acp_commands::acp_reorder_agents_core(¶ms.agent_types, &db, &emitter) + acp_commands::acp_reorder_agents_core(¶ms.agent_types, db, &emitter) .await .map_err(|e| AppCommandError::task_execution_failed(e.to_string()))?; Ok(Json(())) diff --git a/src-tauri/src/web/mod.rs b/src-tauri/src/web/mod.rs index 2d511f9..cc1dcce 100644 --- a/src-tauri/src/web/mod.rs +++ b/src-tauri/src/web/mod.rs @@ -21,6 +21,12 @@ pub struct WebServerState { running: std::sync::atomic::AtomicBool, } +impl Default for WebServerState { + fn default() -> Self { + Self::new() + } +} + impl WebServerState { pub fn new() -> Self { Self {