From ef18500100811a4abee19e087e0a32ff84f9cb2b Mon Sep 17 00:00:00 2001 From: oudecheng <13802883547@139.com> Date: Thu, 25 Jun 2026 10:50:16 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=20created=5Fby=5Fmes?= =?UTF-8?q?sage=5Fid=20=E5=AD=97=E6=AE=B5=E7=9A=84=E8=B5=8B=E5=80=BC?= =?UTF-8?q?=E9=80=BB=E8=BE=91=EF=BC=8C=E7=A1=AE=E4=BF=9D=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=20tool=5Fcall=5Fid=20=E8=BF=9B=E8=A1=8C=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E5=85=B3=E8=81=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/gateway/session.rs | 7 +------ src/tools/task/runtime.rs | 7 +------ web/src/App.tsx | 14 ++++++++++---- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/gateway/session.rs b/src/gateway/session.rs index 0c81869..8598913 100644 --- a/src/gateway/session.rs +++ b/src/gateway/session.rs @@ -200,12 +200,7 @@ impl BusToolCallEmitter { priority: "medium".to_string(), created_at: now + idx as i64, updated_at: now, - created_by_message_id: item - .get("created_by_message_id") - .and_then(|v| v.as_str()) - .filter(|s| !s.is_empty()) - .map(|s| s.to_string()) - .or_else(|| Some(message.id.clone())), + created_by_message_id: message.tool_call_id.clone(), }) }) .collect(); diff --git a/src/tools/task/runtime.rs b/src/tools/task/runtime.rs index d0debcb..dcc77f7 100644 --- a/src/tools/task/runtime.rs +++ b/src/tools/task/runtime.rs @@ -235,12 +235,7 @@ impl SubAgentEmitter { priority: "medium".to_string(), created_at: now + idx as i64, updated_at: now, - created_by_message_id: item - .get("created_by_message_id") - .and_then(|v| v.as_str()) - .filter(|s| !s.is_empty()) - .map(|s| s.to_string()) - .or_else(|| Some(message.id.clone())), + created_by_message_id: message.tool_call_id.clone(), }) }) .collect(); diff --git a/web/src/App.tsx b/web/src/App.tsx index acb471a..6b3ad5a 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -401,11 +401,12 @@ function App() { // 点击待办项后滚动到对应消息 const handleTodoClick = useCallback((todo: TodoItemSummary) => { - // 直接使用后端返回的 created_by_message_id if (todo.created_by_message_id) { - setHighlightedMessageId(todo.created_by_message_id) + // 先清再设,确保同一 todo 重复点击也能触发 useEffect + setHighlightedMessageId(null) + const msgId = todo.created_by_message_id + setTimeout(() => setHighlightedMessageId(msgId), 0) } else { - // 如果消息 ID 不存在(旧数据),给出友好提示 alert('该待办的完成记录无法定位,可能是历史数据') } }, [setHighlightedMessageId]) @@ -485,7 +486,12 @@ function App() { } } - return result + // 过滤无实质内容的 merged_tool(无结果且非等待中) + return result.filter(msg => { + if (msg.type !== 'merged_tool') return true + if (msg.status === 'pending') return true + return !!(msg.resultContent && msg.resultContent.trim()) + }) }, [messages]) // 视图标识:用于 MessageList 保存/恢复每个视图的滚动位置