From 3dcb3c6fea5a497469edfcdceeaefbb6bce62d77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BB=9D=E5=B0=98?= <237809796@qq.com> Date: Sun, 11 Oct 2026 07:38:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E:=20=E6=88=AA=E6=96=AD?= =?UTF-8?q?=E6=A0=87=E8=AE=B0=E4=BA=8B=E4=BB=B6=E5=A5=91=E7=BA=A6=E5=AD=97?= =?UTF-8?q?=E6=AE=B5(953=20=E5=90=8E=E7=AB=AF=E9=85=8D=E5=A5=97)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit AiChatEvent 补 truncated_by_max_tokens, 与前端提示条消费配套 --- src-tauri/src/commands/ai/mod.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src-tauri/src/commands/ai/mod.rs b/src-tauri/src/commands/ai/mod.rs index 2c83c41..2eccb20 100644 --- a/src-tauri/src/commands/ai/mod.rs +++ b/src-tauri/src/commands/ai/mod.rs @@ -198,6 +198,13 @@ pub enum AiChatEvent { /// (provider 未报,前端 MessageList 据此标「估算」),false=真实值。仅影响展示, /// 不参与 TokenAccumulator/save 累加路径。 is_estimated: bool, + /// 看板 953:最终收敛回复是否因 provider max_tokens 上限被截断(finish_reason=length)。 + /// true=正常收敛路径文本被腰斩,前端主对话末条 assistant 气泡渲染截断提示条 + 继续输出; + /// false=完整。仅 agentic loop 正常收敛出口可传 true,停止/错误/保文/达轮次上限等 + /// 退出点及零 token 收敛信号恒 false(截断语义与 incomplete 正交,不冒充不完整)。 + /// #[serde(default)]:旧事件缺字段时前端按 false 兜底,向后兼容。 + #[serde(default)] + truncated_by_max_tokens: bool, /// 不完整标记(可选):Some(true)=网络中断保文,None 或 Some(false)=完整回复 incomplete: Option, /// 不完整原因(与 incomplete 配合):Some("max_rounds")=达最大轮次自动收尾,