优化时间工具

This commit is contained in:
2026-06-11 18:07:44 +08:00
parent d1324dc2f2
commit f20247b04e
2 changed files with 22 additions and 9 deletions
+2 -2
View File
@@ -23,7 +23,7 @@ func TestResolveBuildsCalendarRanges(t *testing.T) {
func TestBuildContextIncludesSQLHints(t *testing.T) {
ctx := Resolve(time.Date(2026, 6, 10, 13, 14, 15, 0, time.UTC))
text := BuildContext(ctx, "需要日期范围")
for _, want := range []string{"时间工具结果", "本月", "start=", "end_exclusive=", "半开区间", "需要日期范围"} {
for _, want := range []string{"时间工具结果", "本月", "start=", "end_exclusive=", "星期三", "星期一", "半开区间", "需要日期范围"} {
if !strings.Contains(text, want) {
t.Fatalf("context missing %q:\n%s", want, text)
}
@@ -39,7 +39,7 @@ func TestToolDefinitionAndExecuteTool(t *testing.T) {
if err != nil {
t.Fatal(err)
}
for _, want := range []string{"时间工具结果", "2026-06-10", "本月", "start=", "end_exclusive=", "测试原因"} {
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)
}