From 6788a75ca6ff5bd43a331dd5d690cd50a269e11a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Thu, 1 Oct 2026 13:52:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E9=A1=B5=20limit=20=E7=9A=84=E8=AF=8A?= =?UTF-8?q?=E6=96=AD=E6=94=B9=E6=88=90=E3=80=8C=E9=9D=9E=E8=B4=9F=E6=95=B4?= =?UTF-8?q?=E6=95=B0=E3=80=8D=EF=BC=8C=E4=B8=8E=20offset=20=E4=BF=9D?= =?UTF-8?q?=E6=8C=81=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - ToolPageRejection::LimitNotInteger 原文案说 limit「必须是整数」,但负数(如 -1)走到这个分支时本身就是整数,读起来自相矛盾 - 解析用的是 as_u64,真实约束是非负;文案改成与 OffsetNotInteger 相同的「非负整数」,只改措辞,判定与变体结构不变 验证:cargo check --bin genarrative-ai-game-creator-shell --tests 通过 --- apps/ai-game-creator-shell/src-tauri/src/agent/tool/error.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/ai-game-creator-shell/src-tauri/src/agent/tool/error.rs b/apps/ai-game-creator-shell/src-tauri/src/agent/tool/error.rs index edf287424..fbed8af41 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/agent/tool/error.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/agent/tool/error.rs @@ -111,7 +111,7 @@ impl ToolFailure for ToolPageRejection { format!("工具参数 offset={got} 超出上限 {max},请从更小的偏移重新分页。") } Self::LimitNotInteger { got } => { - format!("工具参数 limit 必须是整数,当前是「{got}」。") + format!("工具参数 limit 必须是非负整数,当前是「{got}」。") } Self::LimitOutOfRange { got, max } => { format!("工具参数 limit={got} 超出范围,必须在 1 到 {max} 之间。")