feat(skills): 场景预设 - 提供公开只读目录并校验内置技能引用 (#603)

This commit is contained in:
Wyatt_K
2026-09-23 16:01:27 +08:00
committed by ddCat
parent 7ebdd06268
commit ec81a1b92b
8 changed files with 364 additions and 0 deletions

View File

@@ -22,6 +22,7 @@ func TestRegisterCanvasAPIExposesOpenAPIAndProjects(t *testing.T) {
"POST /api/tasks": false,
"POST /api/tasks/:id/recover-media": false,
"GET /api/resources": false,
"GET /api/skills/presets": false,
}
for _, route := range router.Routes() {
key := route.Method + " " + route.Path
@@ -40,4 +41,10 @@ func TestRegisterCanvasAPIExposesOpenAPIAndProjects(t *testing.T) {
if recorder.Code != http.StatusOK || !strings.Contains(recorder.Body.String(), "openapi: 3.0.3") || !strings.Contains(recorder.Body.String(), "url: /api") {
t.Fatalf("openapi.yaml status=%d body=%s", recorder.Code, recorder.Body.String())
}
recorder = httptest.NewRecorder()
router.ServeHTTP(recorder, httptest.NewRequest(http.MethodGet, "/api/skills/presets", nil))
if recorder.Code != http.StatusOK || !strings.Contains(recorder.Body.String(), `"presets"`) {
t.Fatalf("skills presets status=%d body=%s", recorder.Code, recorder.Body.String())
}
}