fix: detect uppercase HTML tags in chat rendering
Some checks failed
BotUI CI/CD / build (push) Failing after 36s

The regex for HTML detection only matched lowercase tags [a-z],
but models like openai/gpt-oss-120b output uppercase HTML tags.
This caused blank squares to appear instead of rendered HTML.

Updated all 6 occurrences in chat.html and partials/chat.html
to use [a-zA-Z] for case-insensitive tag detection.
This commit is contained in:
Rodrigo Rodriguez (Pragmatismo) 2026-04-14 11:29:50 -03:00
parent 910b7d42e7
commit b87feb3d21
2 changed files with 6 additions and 6 deletions

View file

@ -301,7 +301,7 @@
"</div>";
} else {
// Check if content has HTML (any tag, including comments)
var hasHtmlTags = /<\/?[a-z][^>]*>|<!--|-->/i.test(content);
var hasHtmlTags = /<\/?[a-zA-Z][^>]*>|<!--|-->/i.test(content);
console.log("Bot message - hasHtmlTags:", hasHtmlTags, "content length:", content.length);
var parsed = hasHtmlTags
@ -739,7 +739,7 @@
var el = document.getElementById(streamingMessageId);
if (el) {
// Check if content has HTML tags
var hasHtmlTags = /<\/?[a-z][^>]*>|<!--|-->/i.test(content);
var hasHtmlTags = /<\/?[a-zA-Z][^>]*>|<!--|-->/i.test(content);
var parsed = hasHtmlTags
? content // Use HTML directly
: (typeof marked !== "undefined" && marked.parse
@ -754,7 +754,7 @@
var el = document.getElementById(streamingMessageId);
if (el) {
// Check if content has HTML tags
var hasHtmlTags = /<\/?[a-z][^>]*>|<!--|-->/i.test(currentStreamingContent);
var hasHtmlTags = /<\/?[a-zA-Z][^>]*>|<!--|-->/i.test(currentStreamingContent);
var parsed = hasHtmlTags
? currentStreamingContent // Use HTML directly
: (typeof marked !== "undefined" && marked.parse

View file

@ -505,7 +505,7 @@
"</div>";
} else {
// Check if content has HTML (any tag, including comments)
var hasHtmlTags = /<\/?[a-z][^>]*>|<!--|-->/i.test(content);
var hasHtmlTags = /<\/?[a-zA-Z][^>]*>|<!--|-->/i.test(content);
console.log("Bot message - hasHtmlTags:", hasHtmlTags, "content length:", content.length);
var parsed = hasHtmlTags
@ -943,7 +943,7 @@
var el = document.getElementById(streamingMessageId);
if (el) {
// Check if content has HTML tags
var hasHtmlTags = /<\/?[a-z][^>]*>|<!--|-->/i.test(content);
var hasHtmlTags = /<\/?[a-zA-Z][^>]*>|<!--|-->/i.test(content);
var parsed = hasHtmlTags
? content // Use HTML directly
: (typeof marked !== "undefined" && marked.parse
@ -958,7 +958,7 @@
var el = document.getElementById(streamingMessageId);
if (el) {
// Check if content has HTML tags
var hasHtmlTags = /<\/?[a-z][^>]*>|<!--|-->/i.test(currentStreamingContent);
var hasHtmlTags = /<\/?[a-zA-Z][^>]*>|<!--|-->/i.test(currentStreamingContent);
var parsed = hasHtmlTags
? currentStreamingContent // Use HTML directly
: (typeof marked !== "undefined" && marked.parse