refactor: enhance XML tool call parsing to support nested structures, CDATA, and repeated tags

This commit is contained in:
CJACK
2026-04-19 19:58:45 +08:00
parent 26d195f2a6
commit 0f2b5fee23
16 changed files with 550 additions and 140 deletions

View File

@@ -195,9 +195,12 @@ func TestMessagesPrepareAssistantMarkers(t *testing.T) {
if strings.Count(got, "<end▁of▁sentence>") != 1 {
t.Fatalf("expected one end_of_sentence (assistant only), got %q", got)
}
if !strings.Contains(got, "<Assistant></think>Hello!<end▁of▁sentence>") {
if !strings.Contains(got, "<Assistant>Hello!<end▁of▁sentence>") {
t.Fatalf("expected assistant EOS suffix, got %q", got)
}
if strings.Contains(got, "<think>") || strings.Contains(got, "</think>") {
t.Fatalf("did not expect think tags in prompt, got %q", got)
}
if strings.Contains(got, "<system_instructions>") {
t.Fatalf("did not expect legacy system marker, got %q", got)
}