thread-master/backend/internal/library/matrix/reference.go

45 lines
972 B
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package matrix
import (
"strings"
libweb "haixun-backend/internal/library/webpage"
)
func FormatCopyResearchMapBlockWithReferences(
audience, goal string,
questions, pillars, exclusions []string,
knowledgeItems []string,
researchItemsBlock string,
referenceMarkdown string,
) string {
base := FormatCopyResearchMapBlock(
audience,
goal,
questions,
pillars,
exclusions,
knowledgeItems,
)
research := strings.TrimSpace(researchItemsBlock)
if research != "" {
if base == "" {
base = "研究來源Brave\n" + research
} else {
base += "\n\n研究來源Brave\n" + research
}
}
ref := strings.TrimSpace(referenceMarkdown)
if ref == "" {
return base
}
if base == "" {
return "參考網頁Markdown\n" + ref
}
return base + "\n\n參考網頁Markdown\n" + ref
}
func BuildReferenceMarkdown(digests []libweb.Digest) string {
return libweb.FormatMarkdownBlock(digests, libweb.DefaultMaxMarkdown)
}