mirror of
https://github.com/iib0011/omni-tools.git
synced 2025-09-20 06:29:32 +02:00
feat: split pdf
This commit is contained in:
@@ -63,12 +63,14 @@ export default function ToolFileResult({
|
||||
}
|
||||
};
|
||||
|
||||
type SupportedFileType = 'image' | 'video' | 'audio' | 'pdf' | 'unknown';
|
||||
// Determine the file type based on MIME type
|
||||
const getFileType = () => {
|
||||
const getFileType = (): SupportedFileType => {
|
||||
if (!value) return 'unknown';
|
||||
if (value.type.startsWith('image/')) return 'image';
|
||||
if (value.type.startsWith('video/')) return 'video';
|
||||
if (value.type.startsWith('audio/')) return 'audio';
|
||||
if (value.type.startsWith('application/pdf')) return 'pdf';
|
||||
return 'unknown';
|
||||
};
|
||||
|
||||
@@ -135,6 +137,14 @@ export default function ToolFileResult({
|
||||
style={{ width: '100%', maxWidth: '500px' }}
|
||||
/>
|
||||
)}
|
||||
{fileType === 'pdf' && (
|
||||
<iframe
|
||||
src={preview}
|
||||
width="100%"
|
||||
height="100%"
|
||||
style={{ maxWidth: '500px' }}
|
||||
/>
|
||||
)}
|
||||
{fileType === 'unknown' && (
|
||||
<Box sx={{ padding: 2, textAlign: 'center' }}>
|
||||
File processed successfully. Click download to save the
|
||||
|
Reference in New Issue
Block a user