From ed6adad9c5065fdbc59e7e18ca7eb10c0ab9f829 Mon Sep 17 00:00:00 2001 From: Akira Hayashi Date: Fri, 20 Dec 2024 13:12:25 +0900 Subject: [PATCH] Specify `pdfWorker` to avoid error from PDF.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The error got: > тип Error: Setting up fake worker failed: "Cannot find module '/SOME_PATH/giselles-ai/giselle/.next/server/chunks/ssr/pdf.worker.mjs' imported from /SOME_PATH/giselles-ai/giselle/.next/server/chunks/ssr/node_modules_pdfjs-dist_build_pdf_mjs_c60773._.js". at /SOME_PATH/giselles-ai/giselle/.next/server/chunks/ssr/node_modules_pdfjs-dist_build_pdf_mjs_c60773._.js:12706:42 digest: "3292027865" --- lib/opentelemetry/wrapper.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/opentelemetry/wrapper.ts b/lib/opentelemetry/wrapper.ts index 81b4b986..0e9eb2b7 100644 --- a/lib/opentelemetry/wrapper.ts +++ b/lib/opentelemetry/wrapper.ts @@ -4,6 +4,7 @@ import type { LanguageModelUsage } from "ai"; import type { LanguageModelV1 } from "ai"; import type { PDFDocumentProxy } from "pdfjs-dist"; import { getDocument } from "pdfjs-dist"; +import * as pdfWorker from "pdfjs-dist/build/pdf.worker.mjs"; import type { UnstructuredClient } from "unstructured-client"; import type { PartitionResponse } from "unstructured-client/sdk/models/operations/partition"; import type { Strategy } from "unstructured-client/sdk/models/shared";