LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows
Python ai-agentsdata-engineeringdocument-aigenerative-aiidpjson-extractionllmmcp-serverocrpdf-extractionprompt-engineeringstructured-output
[MISC] Load pdfjs worker from node_modules instead of CDN (#1716)
Chandrasekharan Mab906b3e4254
diff --git a/frontend/src/components/custom-tools/pdf-viewer/PdfViewer.jsx b/frontend/src/components/custom-tools/pdf-viewer/PdfViewer.jsxindex ca81cbba9..58f4cff85 100644--- a/frontend/src/components/custom-tools/pdf-viewer/PdfViewer.jsx+++ b/frontend/src/components/custom-tools/pdf-viewer/PdfViewer.jsx@@ -4,8 +4,10 @@ import { defaultLayoutPlugin } from "@react-pdf-viewer/default-layout";import { pageNavigationPlugin } from "@react-pdf-viewer/page-navigation";import PropTypes from "prop-types";import { highlightPlugin } from "@react-pdf-viewer/highlight";+import "@react-pdf-viewer/highlight/lib/styles/index.css";import "./Highlight.css";+import { PDF_WORKER_URL } from "../../../helpers/pdfWorkerConfig";let RenderHighlights;try {@@ -97,7 +99,7 @@ function PdfViewer({ fileUrl, highlightData, currentHighlightIndex }) {return (<div ref={parentRef} className="doc-manager-body">- <Worker workerUrl="https://unpkg.com/[email protected]/build/pdf.worker.min.js">+ <Worker workerUrl={PDF_WORKER_URL}><ViewerfileUrl={fileUrl}plugins={[diff --git a/frontend/src/helpers/pdfWorkerConfig.js b/frontend/src/helpers/pdfWorkerConfig.jsnew file mode 100644index 000000000..26e25a720--- /dev/null+++ b/frontend/src/helpers/pdfWorkerConfig.js@@ -0,0 +1,6 @@+// Webpack 5 / Vite compatible asset module+// Works with both CRA (Webpack) and Vite bundlers+export const PDF_WORKER_URL = new URL(+ "pdfjs-dist/build/pdf.worker.min.js",+ import.meta.url+).toString();