🐛 fix(chatMessage/index.tsx): add optional chaining to template.split() to handle cases where template is null or undefined

This commit is contained in:
Cristhian Zanforlin Lousa 2023-07-08 08:38:08 -03:00
commit 7dcaf709da

View file

@ -147,7 +147,7 @@ export default function ChatMessage({
</button>
<span className="prose inline-block break-words text-primary dark:prose-invert">
{promptOpen
? template.split("\n").map((line, index) => {
? template?.split("\n")?.map((line, index) => {
const regex = /{([^}]+)}/g;
let match;
let parts = [];