H-337: restore Captain inbox takeover and KB citations (#65)

* fix(captain): restore inbox takeover and KB citations

* fix(captain): harden grounded citations and smoke seed

---------

Co-authored-by: Rogee <rogee@ipao.vip>
This commit is contained in:
Rogee
2026-08-20 22:33:38 +08:00
committed by GitHub
co-authored by rogee
parent b31b1b9562
commit d948222ac6
12 changed files with 358 additions and 40 deletions
+1 -1
View File
@@ -179,7 +179,7 @@ func fixtureChatMessage(req chatRequest) (chatMessage, string) {
}
}
if strings.Contains(all, "Knowledge Base Context:") {
return chatMessage{Role: "assistant", Content: "The local fixture warranty window is 37 days [FAQ 1]."}, "stop"
return chatMessage{Role: "assistant", Content: "The local fixture warranty window is 37 days [[1](http://captain-fixture:8080/knowledge)]."}, "stop"
}
return chatMessage{Role: "assistant", Content: "Fixture chat response."}, "stop"
}
@@ -52,6 +52,10 @@ func TestAcceptanceFixtureContract(t *testing.T) {
if status := post(t, server.URL+"/v1/chat/completions", faq, &response); status != http.StatusOK || len(response.Choices) != 1 || !strings.Contains(response.Choices[0].Message.Content, `"faqs"`) {
t.Fatalf("faq status=%d choices=%d", status, len(response.Choices))
}
grounded := `{"model":"gpt-5.6-luna","messages":[{"role":"system","content":"Knowledge Base Context:\nSource: http://captain-fixture:8080/knowledge"},{"role":"user","content":"warranty?"}]}`
if status := post(t, server.URL+"/v1/chat/completions", grounded, &response); status != http.StatusOK || !strings.Contains(response.Choices[0].Message.Content, "[[1](http://captain-fixture:8080/knowledge)]") {
t.Fatalf("grounded status=%d content=%q", status, response.Choices[0].Message.Content)
}
})
t.Run("skill activation", func(t *testing.T) {