27ee14cc97
build / build (push) Successful in 2m53s
095aa3e 新增的两个文件缺文件尾换行,gofmt -l 命中,CI 的 make verify
format 项失败(run 520),提测门禁红。仅补换行,无逻辑改动。
21 lines
818 B
Go
21 lines
818 B
Go
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)
|
|
}
|