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