package weknora import ( "net/url" "strings" ) // KnowledgeBaseConsoleURL builds the console link for one knowledge base. // Reconciliation findings and the platform task drawer both use this rule: if // they drift, the same knowledge base opens at two different addresses, and the // 503 fallback link in one drawer points somewhere else than the other. // An empty origin or base id yields an empty link, which both callers treat as // "no link configured" rather than inventing a host. func KnowledgeBaseConsoleURL(origin, knowledgeBaseID string) string { origin, knowledgeBaseID = strings.TrimSpace(origin), strings.TrimSpace(knowledgeBaseID) if origin == "" || knowledgeBaseID == "" { return "" } return strings.TrimSuffix(origin, "/") + "/platform/knowledge-bases/" + url.PathEscape(knowledgeBaseID) }