bing styling in progress

This commit is contained in:
Danny Avila 2023-03-09 16:09:53 -05:00
parent eae82edb83
commit 5e57deab5f
7 changed files with 58 additions and 22 deletions

13
api/app/getCitations.js Normal file
View file

@ -0,0 +1,13 @@
// const regex = / \[\d+\..*?\]\(.*?\)/g;
const regex = / \[.*?]\(.*?\)/g;
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 '';
links = links.map((link) => '- ' + link.trim());
return 'Learn more:\n' + links.join('\n');
};
module.exports = getCitations;