mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-25 19:56:13 +01:00
feat: includes sources
This commit is contained in:
parent
a451574760
commit
30936573ac
6 changed files with 49 additions and 9 deletions
|
|
@ -8,7 +8,7 @@ const citeText = (res, noLinks = false) => {
|
|||
if (noLinks) {
|
||||
citations.forEach((citation) => {
|
||||
const digit = citation.match(/\d+?/g)[0];
|
||||
result = result.replaceAll(citation, `<sup>[${digit}](#)</sup>`);
|
||||
result = result.replaceAll(citation, `<sup>[${digit}](#) </sup>`);
|
||||
});
|
||||
|
||||
return result;
|
||||
|
|
@ -20,7 +20,7 @@ const citeText = (res, noLinks = false) => {
|
|||
|
||||
citations.forEach((citation) => {
|
||||
const digit = citation.match(/\d+?/g)[0];
|
||||
result = result.replaceAll(citation, `<sup>[${digit}](${sources[digit - 1]})</sup>`);
|
||||
result = result.replaceAll(citation, `<sup>[${digit}](${sources[digit - 1]}) </sup>`);
|
||||
});
|
||||
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ const getCitations = (res) => {
|
|||
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 'Learn more:\n' + links.join('\n');
|
||||
links = links.map((link) => link.trim());
|
||||
return links.join('\n');
|
||||
};
|
||||
|
||||
module.exports = getCitations;
|
||||
Loading…
Add table
Add a link
Reference in a new issue