feat(settings): worker 能力心跳读取 + 封存源对照 + 知识库映射合并
build / build (push) Successful in 2m6s

F01:新增 /api/v1/system/worker-capabilities,按 job_types 判定 test.upload 执行器是否注册,
服务卡片分「地址可达 / 凭据与库读取 / 执行器能力」三行。
F04:routing-bindings 返回 LIBRARY_SOURCE_KB_* 与一致性,设置页同屏显示入库目标与封存源。
结构:测试绑定与生产目标合并为「知识库映射」。
This commit is contained in:
dev
2026-11-17 16:04:00 +08:00
parent 33afdb9f11
commit 8e6094e9e5
14 changed files with 438 additions and 28 deletions
+23 -1
View File
@@ -41,6 +41,24 @@ type routingBindingView struct {
// that had not been uploaded yet. A plain read reports zeros.
Replanned int `json:"replanned"`
RetiredDuplicates int `json:"retired_duplicates"`
// 整库封存源(LIBRARY_SOURCE_KB_*)与“测试入库绑定”是两套配置:
// 页面必须同时给出两者,并标明是否一致,避免改绑后名字变了、封存还是旧库。
LibrarySourceInternalKB string `json:"library_source_internal_kb"`
LibrarySourceExternalKB string `json:"library_source_external_kb"`
InternalSourceState string `json:"internal_source_state"`
ExternalSourceState string `json:"external_source_state"`
}
// sourceState 只回答“入库目标与封存源是不是同一个库”。
func sourceState(binding, source string) string {
switch {
case source == "":
return "unconfigured"
case binding == source:
return "consistent"
default:
return "mismatch"
}
}
type routingKnowledgeBaseOption struct {
@@ -101,7 +119,11 @@ func (config Config) routingBindingPayload(ctx context.Context, replan postgress
InternalEnvFallback: storedInternal == "" && config.InternalRoutingKnowledgeBaseID != "",
ExternalEnvFallback: storedExternal == "" && config.ExternalRoutingKnowledgeBaseID != "",
InternalKBName: names[storedInternal], ExternalKBName: names[storedExternal],
UpdatedBy: updatedBy, WeKnoraConnected: connected,
LibrarySourceInternalKB: config.LibrarySourceInternalKB,
LibrarySourceExternalKB: config.LibrarySourceExternalKB,
InternalSourceState: sourceState(internal, config.LibrarySourceInternalKB),
ExternalSourceState: sourceState(external, config.LibrarySourceExternalKB),
UpdatedBy: updatedBy, WeKnoraConnected: connected,
Replanned: replan.Replanned, RetiredDuplicates: replan.RetiredDuplicates,
}, nil
}