Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -107,30 +107,17 @@ def render_message(history):
|
|
| 107 |
<span style='color: white;'>{assistant_message_html}</span>
|
| 108 |
</div><br>"""
|
| 109 |
|
| 110 |
-
messages_html += "
|
|
|
|
|
|
|
|
|
|
| 111 |
return messages_html
|
| 112 |
|
| 113 |
|
| 114 |
js = """
|
| 115 |
-
function
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
console.error('Messages container not found!');
|
| 119 |
-
return;
|
| 120 |
-
}
|
| 121 |
-
const observer = new MutationObserver((mutationsList, observer) => {
|
| 122 |
-
for (const mutation of mutationsList) {
|
| 123 |
-
if (mutation.type === 'childList') {
|
| 124 |
-
const chatboxContainer = document.getElementById('chatbox-container');
|
| 125 |
-
if (chatboxContainer) {
|
| 126 |
-
chatboxContainer.scrollTop = chatboxContainer.scrollHeight;
|
| 127 |
-
}
|
| 128 |
-
}
|
| 129 |
-
}
|
| 130 |
-
});
|
| 131 |
-
const config = { childList: true };
|
| 132 |
-
observer.observe(messagesContainer, config);
|
| 133 |
-
console.log('Observing');
|
| 134 |
}
|
| 135 |
"""
|
| 136 |
|
|
|
|
| 107 |
<span style='color: white;'>{assistant_message_html}</span>
|
| 108 |
</div><br>"""
|
| 109 |
|
| 110 |
+
messages_html += """
|
| 111 |
+
</div></div>
|
| 112 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/dompurify/2.3.3/purify.min.js"></script>
|
| 113 |
+
"""
|
| 114 |
return messages_html
|
| 115 |
|
| 116 |
|
| 117 |
js = """
|
| 118 |
+
function HTMLClean() {
|
| 119 |
+
var cleanHTML = DOMPurify.sanitize(userInputHTML);
|
| 120 |
+
document.getElementById("output").innerHTML = cleanHTML;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
}
|
| 122 |
"""
|
| 123 |
|