feat: cites text with links

This commit is contained in:
Daniel Avila 2023-03-09 18:07:36 -05:00
parent 5e57deab5f
commit a451574760
6 changed files with 31 additions and 25 deletions

View file

@ -5,7 +5,7 @@ const getCitations = (res) => {
const textBlocks = res.details.adaptiveCards[0].body;
if (!textBlocks) return '';
let links = textBlocks[textBlocks.length - 1]?.text.match(regex);
if (links?.length === 0) return '';
if (links?.length === 0 || !links) return '';
links = links.map((link) => '- ' + link.trim());
return 'Learn more:\n' + links.join('\n');
};