feat(copilot): finish configuration center
This commit is contained in:
@@ -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"])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user