diff --git a/.changeset/young-cameras-boil.md b/.changeset/young-cameras-boil.md new file mode 100644 index 0000000000000000000000000000000000000000..52ee94182aecca1b1a8ea094b3215e4c6f36ddaf --- /dev/null +++ b/.changeset/young-cameras-boil.md @@ -0,0 +1,5 @@ +--- +"create-llama": patch +--- + +Upgrade pdf viewer diff --git a/templates/types/streaming/nextjs/app/components/ui/chat/widgets/PdfDialog.tsx b/templates/types/streaming/nextjs/app/components/ui/chat/widgets/PdfDialog.tsx index 42c2ad47d09b19c138acbe39525acad8abb6cb28..8dafffc4549a93fcf47aef19f826675714901135 100644 --- a/templates/types/streaming/nextjs/app/components/ui/chat/widgets/PdfDialog.tsx +++ b/templates/types/streaming/nextjs/app/components/ui/chat/widgets/PdfDialog.tsx @@ -1,4 +1,4 @@ -import { PDFViewer, PdfFocusProvider } from "@llamaindex/pdf-viewer"; +import dynamic from "next/dynamic"; import { Button } from "../../button"; import { Drawer, @@ -16,6 +16,18 @@ export interface PdfDialogProps { trigger: React.ReactNode; } +// Dynamic imports for client-side rendering only +const PDFViewer = dynamic( + () => import("@llamaindex/pdf-viewer").then((module) => module.PDFViewer), + { ssr: false }, +); + +const PdfFocusProvider = dynamic( + () => + import("@llamaindex/pdf-viewer").then((module) => module.PdfFocusProvider), + { ssr: false }, +); + export default function PdfDialog(props: PdfDialogProps) { return ( <Drawer direction="left"> diff --git a/templates/types/streaming/nextjs/package.json b/templates/types/streaming/nextjs/package.json index 7cb91d79b6d80042fa5ac1399081be28914715a0..59e8dafab1638da8904c91d72449aeecf719763a 100644 --- a/templates/types/streaming/nextjs/package.json +++ b/templates/types/streaming/nextjs/package.json @@ -12,7 +12,7 @@ "dependencies": { "@apidevtools/swagger-parser": "^10.1.0", "@e2b/code-interpreter": "^0.0.5", - "@llamaindex/pdf-viewer": "^1.1.1", + "@llamaindex/pdf-viewer": "^1.1.3", "@radix-ui/react-collapsible": "^1.0.3", "@radix-ui/react-hover-card": "^1.0.7", "@radix-ui/react-slot": "^1.0.2",