更新工具链

This commit is contained in:
2026-06-11 18:04:47 +08:00
parent 440f83f6a7
commit d1324dc2f2
9 changed files with 718 additions and 570 deletions
+16
View File
@@ -29,3 +29,19 @@ func TestBuildContextIncludesSQLHints(t *testing.T) {
}
}
}
func TestToolDefinitionAndExecuteTool(t *testing.T) {
definition := ToolDefinition("custom description")
if definition.Function == nil || definition.Function.Name != ToolName || definition.Function.Description != "custom description" {
t.Fatalf("unexpected definition: %#v", definition)
}
text, err := ExecuteTool(`{"reason":"测试原因"}`, time.Date(2026, 6, 10, 13, 14, 15, 0, time.UTC))
if err != nil {
t.Fatal(err)
}
for _, want := range []string{"时间工具结果", "2026-06-10", "本月", "start=", "end_exclusive=", "测试原因"} {
if !strings.Contains(text, want) {
t.Fatalf("tool result missing %q:\n%s", want, text)
}
}
}