Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

* refactor(getCitations.js): add null check for adaptiveCards variable before accessing its properties (#232)

Youth7997c3137acb
diff --git a/api/lib/parse/getCitations.js b/api/lib/parse/getCitations.js
index f4086a4e9e..0e36de695e 100644
--- a/api/lib/parse/getCitations.js
+++ b/api/lib/parse/getCitations.js
@@ -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 '';