6440e3f679
- 迁移 000044:production_kb_bindings + release_item_executions.target_knowledge_base_id - 系统设置新增「生产知识库绑定(对内/对外)」:从生产 WeKnora 实际列表选库, 保存时真校验(不存在拒收;生产端不可达只提示并如实回报),仅管理员可改 - 执行计划按绑定解析目标库并冻结进 release_item_executions;空目标直接拒收; 已发布过的条目保留原目标(重试/回滚回到同一处) - DocumentBundle.RemapKnowledgeBase:knowledges/chunks/knowledge_tags/wiki_pages/ wiki_folders 的 knowledge_base_id 与 ES 文档字段改写为目标库,重算表/文档摘要并重新封装 - 契约比对改为「声明的映射对」(KnowledgeBaseMapping),其余字段继续 fail-closed - 契约检查器 / 目标身份 / 验证器全部走映射后的目标库;对象通道无需改写 - Compose 拆分:数据面接线 compose.release-sim.yaml + 两道门禁 compose.release-gates.yaml - 测试:RemapKnowledgeBase 全通道/无操作/fail-closed、映射契约、绑定接口、RBAC、真实 PG 集成
30 lines
1.1 KiB
Go
30 lines
1.1 KiB
Go
package serviceverify
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
|
|
"knowledge-governance/internal/platform/weknora"
|
|
)
|
|
|
|
// ListProductionKnowledgeBases enumerates the bases a release could be written
|
|
// into. It asks the operator-managed production endpoint with the production
|
|
// credential file, so the settings page can offer real bases instead of asking
|
|
// the operator to paste an id. A missing endpoint or credential is an error the
|
|
// caller reports honestly rather than a silently empty picker.
|
|
func (verifier *Verifier) ListProductionKnowledgeBases(ctx context.Context, baseURL string) ([]weknora.KnowledgeBase, error) {
|
|
resolved := firstNonEmpty(baseURL, verifier.config.ProductionBaseURLFallback)
|
|
if resolved == "" {
|
|
return nil, errors.New("production WeKnora endpoint is not configured")
|
|
}
|
|
apiKey := verifier.apiKey(verifier.config.ProductionAPIKeyFile)
|
|
if apiKey == "" {
|
|
return nil, errors.New("production WeKnora API key file is not available")
|
|
}
|
|
client, err := verifier.client(resolved, apiKey, verifier.config.ProductionAllowDockerHTTP)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return client.ListKnowledgeBases(ctx)
|
|
}
|