Add PDF inline preview support to knowledge base viewer

This commit is contained in:
2026-02-13 10:46:32 -07:00
parent eea226a9d5
commit fa9f4229a6

View File

@@ -191,15 +191,27 @@ export default function KnowledgeBaseViewer({ article, onClose }) {
{/* PDF */} {/* PDF */}
{isPDF && ( {isPDF && (
<div className="text-center py-12"> <div className="w-full" style={{ height: '700px' }}>
<File className="w-16 h-16 mx-auto mb-4" style={{ color: '#EF4444' }} /> <iframe
<p className="mb-4" style={{ color: '#94A3B8' }}> src={`${API_BASE}/knowledge-base/${article.id}/content`}
PDF Preview not available. Click the download button to view this file. title={article.title}
</p> className="w-full h-full rounded"
<button onClick={handleDownload} className="intel-button intel-button-success"> style={{
<Download className="w-4 h-4 mr-2" /> border: '1px solid rgba(14, 165, 233, 0.3)',
Download PDF background: 'rgba(15, 23, 42, 0.8)'
</button> }}
>
<div className="text-center py-12">
<File className="w-16 h-16 mx-auto mb-4" style={{ color: '#EF4444' }} />
<p className="mb-4" style={{ color: '#94A3B8' }}>
Your browser doesn't support PDF preview. Click the download button to view this file.
</p>
<button onClick={handleDownload} className="intel-button intel-button-success">
<Download className="w-4 h-4 mr-2" />
Download PDF
</button>
</div>
</iframe>
</div> </div>
)} )}