agentgui 1.0.87 → 1.0.89
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/static/js/client.js +30 -2
- package/static/js/streaming-renderer.js +15 -3
package/package.json
CHANGED
package/static/js/client.js
CHANGED
|
@@ -376,7 +376,21 @@ class AgentGUIClient {
|
|
|
376
376
|
if (block.type === 'text') {
|
|
377
377
|
html += `<div class="message-text">${this.escapeHtml(block.text)}</div>`;
|
|
378
378
|
} else if (block.type === 'code_block') {
|
|
379
|
-
|
|
379
|
+
// Render HTML code blocks as actual HTML elements
|
|
380
|
+
if (block.language === 'html') {
|
|
381
|
+
html += `
|
|
382
|
+
<div class="message-code">
|
|
383
|
+
<div class="html-rendered-label mb-2 p-2 bg-blue-50 dark:bg-blue-900 rounded border border-blue-200 dark:border-blue-700 text-xs text-blue-700 dark:text-blue-300">
|
|
384
|
+
Rendered HTML
|
|
385
|
+
</div>
|
|
386
|
+
<div class="html-content bg-white dark:bg-gray-800 p-4 rounded border border-gray-200 dark:border-gray-700 overflow-x-auto">
|
|
387
|
+
${block.code}
|
|
388
|
+
</div>
|
|
389
|
+
</div>
|
|
390
|
+
`;
|
|
391
|
+
} else {
|
|
392
|
+
html += `<div class="message-code"><pre>${this.escapeHtml(block.code)}</pre></div>`;
|
|
393
|
+
}
|
|
380
394
|
} else if (block.type === 'tool_use') {
|
|
381
395
|
html += `<div class="message-tool">[Tool: ${this.escapeHtml(block.name)}]</div>`;
|
|
382
396
|
}
|
|
@@ -643,7 +657,21 @@ class AgentGUIClient {
|
|
|
643
657
|
if (block.type === 'text') {
|
|
644
658
|
contentHtml += `<div class="message-text">${this.escapeHtml(block.text)}</div>`;
|
|
645
659
|
} else if (block.type === 'code_block') {
|
|
646
|
-
|
|
660
|
+
// Render HTML code blocks as actual HTML elements
|
|
661
|
+
if (block.language === 'html') {
|
|
662
|
+
contentHtml += `
|
|
663
|
+
<div class="message-code">
|
|
664
|
+
<div class="html-rendered-label mb-2 p-2 bg-blue-50 dark:bg-blue-900 rounded border border-blue-200 dark:border-blue-700 text-xs text-blue-700 dark:text-blue-300">
|
|
665
|
+
Rendered HTML
|
|
666
|
+
</div>
|
|
667
|
+
<div class="html-content bg-white dark:bg-gray-800 p-4 rounded border border-gray-200 dark:border-gray-700 overflow-x-auto">
|
|
668
|
+
${block.code}
|
|
669
|
+
</div>
|
|
670
|
+
</div>
|
|
671
|
+
`;
|
|
672
|
+
} else {
|
|
673
|
+
contentHtml += `<div class="message-code"><pre>${this.escapeHtml(block.code)}</pre></div>`;
|
|
674
|
+
}
|
|
647
675
|
} else if (block.type === 'tool_use') {
|
|
648
676
|
contentHtml += `<div class="message-tool">[Tool: ${this.escapeHtml(block.name)}]</div>`;
|
|
649
677
|
}
|
|
@@ -595,9 +595,21 @@ class StreamingRenderer {
|
|
|
595
595
|
const code = event.code || event.content || '';
|
|
596
596
|
const language = event.language || 'plaintext';
|
|
597
597
|
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
598
|
+
// Render HTML code blocks as actual HTML elements
|
|
599
|
+
if (language === 'html') {
|
|
600
|
+
div.innerHTML = `
|
|
601
|
+
<div class="html-rendered-container mb-2 p-2 bg-blue-50 dark:bg-blue-900 rounded border border-blue-200 dark:border-blue-700 text-xs text-blue-700 dark:text-blue-300">
|
|
602
|
+
Rendered HTML
|
|
603
|
+
</div>
|
|
604
|
+
<div class="html-content bg-white dark:bg-gray-800 p-4 rounded border border-gray-200 dark:border-gray-700 overflow-x-auto">
|
|
605
|
+
${code}
|
|
606
|
+
</div>
|
|
607
|
+
`;
|
|
608
|
+
} else {
|
|
609
|
+
div.innerHTML = `
|
|
610
|
+
<pre class="bg-gray-900 text-gray-100 p-4 rounded overflow-x-auto"><code class="language-${this.escapeHtml(language)}">${this.escapeHtml(code)}</code></pre>
|
|
611
|
+
`;
|
|
612
|
+
}
|
|
601
613
|
return div;
|
|
602
614
|
}
|
|
603
615
|
|