diff --git a/web/src/pages/index.tsx b/web/src/pages/index.tsx index dee86c5..ec90794 100644 --- a/web/src/pages/index.tsx +++ b/web/src/pages/index.tsx @@ -225,7 +225,12 @@ const Home: NextPage = () => { const citations = new Map(); cite_map.forEach((value, key) => { - citations.set(value, data.citations[key.charCodeAt(0) - 'a'.charCodeAt(0)]); + const index = key.charCodeAt(0) - 'a'.charCodeAt(0); + if (index >= data.citations.length) { + console.log("invalid citation index: " + index); + } else { + citations.set(value, data.citations[index]); + } }); setEntries([...new_entries, {role: "assistant",