diff --git a/gui/main.qml b/gui/main.qml index aadc675..362839c 100644 --- a/gui/main.qml +++ b/gui/main.qml @@ -622,7 +622,7 @@ ApplicationWindow { Text { id: callText Layout.fillWidth: true - text: visible ? chatModel.prettyJson(block.blockContent || "") : "" + text: visible ? chatModel.prettyJson(String(block.blockContent || "")) : "" textFormat: Text.RichText wrapMode: Text.Wrap font.family: "monospace" @@ -653,12 +653,12 @@ ApplicationWindow { Layout.fillWidth: true text: { if (!visible) return "" - let content = block.blockContent || "" + let content = String(block.blockContent || "") if (!content) return "" let trimmed = content.trim() - if (trimmed.startsWith("{") || trimmed.startsWith("[")) + if (trimmed.charAt(0) === '{' || trimmed.charAt(0) === '[') return chatModel.prettyJson(content) - if (trimmed.startsWith("---") || trimmed.startsWith("diff ")) + if (trimmed.indexOf("---") === 0 || trimmed.indexOf("diff ") === 0) return chatModel.highlightedHtml(content, "diff") return content.replace(/&/g, '&').replace(//g, '>').replace(/\n/g, '
') }