From 3b0de7d0715f1ac0f72ad1ccc9fdd896102ac817 Mon Sep 17 00:00:00 2001 From: oudecheng <13802883547@139.com> Date: Mon, 3 Aug 2026 14:21:01 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=B8=85=E7=90=86=E6=9C=AA?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E7=9A=84=20dead=20code=20=E5=87=BD=E6=95=B0?= =?UTF-8?q?=E4=B8=8E=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/agent/agent_loop.rs | 11 ----------- src/gateway/session.rs | 3 ++- src/gateway/session_history.rs | 1 + 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/agent/agent_loop.rs b/src/agent/agent_loop.rs index d624386..8362d1a 100644 --- a/src/agent/agent_loop.rs +++ b/src/agent/agent_loop.rs @@ -642,17 +642,6 @@ fn chat_message_to_llm_message(m: &ChatMessage, image_budget: &mut ImageInlineBu } } -fn chat_message_to_text_only_llm_message(m: &ChatMessage) -> Message { - Message { - role: m.role.clone(), - content: vec![ContentBlock::text(&m.content)], - reasoning_content: m.reasoning_content.clone(), - tool_call_id: m.tool_call_id.clone(), - name: m.tool_name.clone(), - tool_calls: m.tool_calls.clone(), - } -} - /// AgentLoop - Stateless agent that processes messages with tool calling support. /// History is managed externally by SessionManager. pub struct AgentLoop { diff --git a/src/gateway/session.rs b/src/gateway/session.rs index 59379eb..cbf5a2e 100644 --- a/src/gateway/session.rs +++ b/src/gateway/session.rs @@ -512,7 +512,8 @@ impl Session { .unwrap_or(false) } - pub(crate) fn matches_current_user_turn(&self, topic_id: &str, message: &ChatMessage) -> bool { + #[cfg(test)] + fn matches_current_user_turn(&self, topic_id: &str, message: &ChatMessage) -> bool { self.history.matches_current_user_turn(topic_id, message) } diff --git a/src/gateway/session_history.rs b/src/gateway/session_history.rs index 6ebf922..aa3437c 100644 --- a/src/gateway/session_history.rs +++ b/src/gateway/session_history.rs @@ -220,6 +220,7 @@ impl SessionHistory { .and_then(|history| history.iter().rev().find(|message| message.role == "user")) } + #[cfg(test)] pub(crate) fn matches_current_user_turn(&self, topic_id: &str, message: &ChatMessage) -> bool { self.latest_user_message(topic_id) .map(|current| {