mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-29 13:46:18 +01:00
bing styling in progress
This commit is contained in:
parent
eae82edb83
commit
5e57deab5f
7 changed files with 58 additions and 22 deletions
13
api/app/getCitations.js
Normal file
13
api/app/getCitations.js
Normal 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;
|
||||
Loading…
Add table
Add a link
Reference in a new issue