diff --git a/src/lib/components/chat/FileNav/FilePreview.svelte b/src/lib/components/chat/FileNav/FilePreview.svelte index 0bfa4fe50..b5a3a30cc 100644 --- a/src/lib/components/chat/FileNav/FilePreview.svelte +++ b/src/lib/components/chat/FileNav/FilePreview.svelte @@ -103,6 +103,13 @@ $: isNotebook = getExt(selectedFile) === 'ipynb'; $: isCode = isCodeFile(selectedFile); $: csvDelimiter = getExt(selectedFile) === 'tsv' ? '\t' : ','; + + // For HTML files on system terminals (proxy URL), use path-based serving + // so the iframe can resolve relative CSS/JS/image references via cookie auth. + $: serveUrl = + isHtml && selectedFile && baseUrl && baseUrl.includes('/api/v1/terminals/') + ? `${baseUrl}/files/serve/${selectedFile.replace(/^\//, '')}` + : null; $: renderedHtml = isMarkdown && fileContent ? DOMPurify.sanitize(marked.parse(fileContent, { async: false }) as string) @@ -386,7 +393,19 @@ {/if} {:else if fileContent !== null} - {#if isHtml && !showRaw} + {#if isHtml && !showRaw && serveUrl} + {#if overlay} +
+ {/if} +