mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 00:40:14 +01:00
* refactor(getCitations.js): add null check for adaptiveCards variable before accessing its properties (#232)
This commit is contained in:
parent
b466b36e7a
commit
7997c3137a
1 changed files with 2 additions and 1 deletions
|
|
@ -2,7 +2,8 @@
|
|||
const regex = / \[.*?]\(.*?\)/g;
|
||||
|
||||
const getCitations = (res) => {
|
||||
const textBlocks = res.details.adaptiveCards[0].body;
|
||||
const adaptiveCards = res.details.adaptiveCards;
|
||||
const textBlocks = adaptiveCards && adaptiveCards[0].body;
|
||||
if (!textBlocks) return '';
|
||||
let links = textBlocks[textBlocks.length - 1]?.text.match(regex);
|
||||
if (links?.length === 0 || !links) return '';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue