Skip to content

Commit

Permalink
chat user messages no escape html (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
gasse authored May 29, 2024
1 parent c63da82 commit 55d2563
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion core/src/browsergym/core/chat_files/chatbox_modern.html
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,6 @@
msgContainer.className = 'message';

const text = document.createElement('div');
text.innerHTML = addHtmlLineBreaks(escapeHtml(msg));

// const assistant_img = document.createElement('img');
// assistant_img.src = assistant_image_data;
Expand All @@ -290,25 +289,29 @@
switch (role) {
case "user":
text.className = 'user-message';
text.innerHTML = addHtmlLineBreaks(msg);
text.style.setProperty('--before-content', `"${timeString} - You"`);
msgContainer.appendChild(text);
chatBody.appendChild(msgContainer);
break;
case "assistant":
text.className = 'assistant-message';
text.innerHTML = addHtmlLineBreaks(escapeHtml(msg));
text.style.setProperty('--before-content', `"${timeString} - Bot"`);
// msgContainer.appendChild(assistant_img); // Add the image to the message container
msgContainer.appendChild(text);
chatBody.appendChild(msgContainer);
break;
case "infeasible":
text.className = 'assistant-message';
text.innerHTML = addHtmlLineBreaks(escapeHtml(msg));
text.style.setProperty('--before-content', `"${timeString} - Bot (abort)"`);
msgContainer.appendChild(text);
chatBody.appendChild(msgContainer);
break;
case "info":
text.className = 'info-message';
text.innerHTML = addHtmlLineBreaks(escapeHtml(msg));
msgContainer.appendChild(text);
// hide previous debug messages
for (const msg of chatDebug.children) {
Expand Down

0 comments on commit 55d2563

Please sign in to comment.