square-magazine-33326
07/07/2023, 11:09 AMacceptable-kangaroo-64719
07/07/2023, 11:25 AMjs
let citations = []
workflow.category = ''
turn.KnowledgeAgent.citations.map((citation) => {
try {
if (/Page Title:/.test(citation)) {
var page_title = /Page Title: (.*?)\(https/.exec(citation)[1].trim()
var page_url = /(?:\((http[^\)]*)\))/.exec(citation)[1]
citations.push(`\n* [${page_title}](${page_url})`)
}
citations = _.uniq(citations)
if (citations.length > 5) {
citations = citations.slice(0, 4)
}
workflow.citationMessage = 'Learn more at the links below:\n' + citations.join()
} catch (e) {
console.error(e)
}
})
After running the code just send @citationMessage
in a text cardsquare-magazine-33326
07/10/2023, 5:45 PMacceptable-kangaroo-64719
07/11/2023, 11:51 AMquick-sunset-51605
07/11/2023, 3:56 PMquick-sunset-51605
07/12/2023, 10:49 AMacceptable-kangaroo-64719
07/12/2023, 11:37 AMfull-helmet-73535
07/12/2023, 12:18 PMquick-sunset-51605
07/12/2023, 12:34 PMquick-sunset-51605
07/12/2023, 12:35 PMfull-helmet-73535
07/12/2023, 12:37 PMquick-sunset-51605
07/12/2023, 12:37 PMquick-sunset-51605
07/12/2023, 12:42 PMquick-sunset-51605
07/12/2023, 12:44 PM