Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
// SPDX-License-Identifier: AGPL-3.0-only
// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
import { Spinner } from "@/components/ui/spinner";
import { Suspense, lazy } from "react";
import type { DocumentKind, PageTarget } from "./kind";
const PdfView = lazy(() => import("./pdf-view"));
const OfficeView = lazy(() => import("./office-view"));
export function DocumentView({
file,
kind,
name,
contentType = "",
scale = 1,
thumbnail = false,
pageTarget,
onPageTargetDone,
}: {
file: Blob;
kind: DocumentKind;
name: string;
contentType?: string;
scale?: number;
thumbnail?: boolean;
/** PDF page to scroll to; a new object asks again. */
pageTarget?: PageTarget;
onPageTargetDone?: () => void;
}) {
return (
<Suspense fallback={<Spinner className="m-auto size-6" />}>
{kind === "pdf" ? (
<PdfView
file={file}
scale={scale}
firstPageOnly={thumbnail}
pageTarget={pageTarget}
onPageTargetDone={onPageTargetDone}
/>
) : (
<OfficeView file={file} kind={kind} name={name} contentType={contentType} scale={scale} thumbnail={thumbnail} />
)}
</Suspense>
);
}