feat(copilot): finish configuration center

This commit is contained in:
2026-07-13 14:57:28 +08:00
parent 0a69d80f7c
commit 8b9eedc0e2
60 changed files with 3040 additions and 1042 deletions
@@ -175,3 +175,29 @@ func TestCaptainPreferencesInvalidAccountID(t *testing.T) {
w := f.request(http.MethodGet, "/api/v1/accounts/abc/captain/preferences", nil)
require.Equal(t, http.StatusBadRequest, w.Code, w.Body.String())
}
func TestCaptainPreferencesUpdateAndClearBehavior(t *testing.T) {
f := newCaptainPreferenceFixture(t)
w := f.request(http.MethodPut, f.path(""), map[string]any{
"behavior": map[string]any{
"tone": "friendly",
"language": "auto",
"max_response_length": 750,
"custom_prompt_suffix": "Use short steps",
"auto_label_enabled": true,
"auto_follow_up_enabled": true,
"auto_reply_enabled": false,
},
})
require.Equal(t, http.StatusOK, w.Code, w.Body.String())
behavior := decodeCaptainPreferencePayload(t, w)["behavior"].(map[string]any)
require.Equal(t, "Use short steps", behavior["custom_prompt_suffix"])
w = f.request(http.MethodPut, f.path(""), map[string]any{
"behavior": map[string]any{"custom_prompt_suffix": ""},
})
require.Equal(t, http.StatusOK, w.Code, w.Body.String())
behavior = decodeCaptainPreferencePayload(t, w)["behavior"].(map[string]any)
require.Equal(t, "", behavior["custom_prompt_suffix"])
}