mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 08:50:15 +01:00
feat: reorganize api files, add mongoMeili
This commit is contained in:
parent
854f1c3572
commit
9995a159aa
15 changed files with 200 additions and 45 deletions
13
api/lib/parse/getCitations.js
Normal file
13
api/lib/parse/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 || !links) return '';
|
||||
links = links.map((link) => link.trim());
|
||||
return links.join('\n');
|
||||
};
|
||||
|
||||
module.exports = getCitations;
|
||||
Loading…
Add table
Add a link
Reference in a new issue