feat(settings): bind internal/external knowledge bases from the UI
Routing targets move from env-only to a UI-managed binding (migration 000034 routing_kb_bindings, single active row): - GET/PUT /api/v1/routing-bindings + /options: env defaults act as the bootstrap fallback; a UI binding wins and takes effect immediately (per-request resolution, no restart), and clearing falls back to env - PUT validates against the connected WeKnora instance (real knowledge base list via the scoped API key) and rejects same-KB bindings; saves require the admin role - route/catalog capabilities now resolve through the binding so both annotation paths share one source of truth - system settings > 服务配置 gains a 知识库绑定 panel: dropdown picker (or raw ID when WeKnora is unreachable) showing bound name, origin (UI vs env default) and last author - contract tests: OpenAPI, handler matrix (fallback, validation, same-KB rejection, capability resolution), frontend fetch/save layer
This commit is contained in:
@@ -117,6 +117,11 @@ func classifyRole(method, path string) string {
|
||||
if strings.Contains(path, "/settings/revisions") {
|
||||
return roleAdmin
|
||||
}
|
||||
// Binding the internal/external knowledge bases re-routes every future
|
||||
// annotation: admin-only, like the roster and production authority.
|
||||
if path == "/api/v1/routing-bindings" && method != http.MethodGet {
|
||||
return roleAdmin
|
||||
}
|
||||
// Everything else that mutates (review, batch, seal, confirm, start, retry,
|
||||
// route visibility, disable) is engineer work; viewers cannot POST at all.
|
||||
return roleEngineer
|
||||
|
||||
Reference in New Issue
Block a user