diff --git a/core/embedjs/src/util/mime.ts b/core/embedjs/src/util/mime.ts index 5dd6561..bb647bd 100644 --- a/core/embedjs/src/util/mime.ts +++ b/core/embedjs/src/util/mime.ts @@ -4,7 +4,7 @@ import { BaseLoader } from '@llm-tools/embedjs-interfaces'; import { TextLoader } from '../loaders/text-loader.js'; export async function createLoaderFromMimeType(loader: string, mimeType: string): Promise { - createDebugMessages('embedjs:core:createLoaderFromMimeType')(`Incoming mime type '${mimeType}'`); + createDebugMessages('embedjs:util:createLoaderFromMimeType')(`Incoming mime type '${mimeType}'`); switch (mimeType) { case 'application/msword': @@ -14,7 +14,7 @@ export async function createLoaderFromMimeType(loader: string, mimeType: string) 'Package `@llm-tools/embedjs-loader-msoffice` needs to be installed to load docx files', ); }); - createDebugMessages('embedjs:core:createLoaderFromMimeType')('Dynamically imported DocxLoader'); + createDebugMessages('embedjs:util:createLoaderFromMimeType')('Dynamically imported DocxLoader'); return new DocxLoader({ filePathOrUrl: loader }); } case 'application/vnd.ms-excel': @@ -24,14 +24,14 @@ export async function createLoaderFromMimeType(loader: string, mimeType: string) 'Package `@llm-tools/embedjs-loader-msoffice` needs to be installed to load excel files', ); }); - createDebugMessages('embedjs:core:createLoaderFromMimeType')('Dynamically imported ExcelLoader'); + createDebugMessages('embedjs:util:createLoaderFromMimeType')('Dynamically imported ExcelLoader'); return new ExcelLoader({ filePathOrUrl: loader }); } case 'application/pdf': { const { PdfLoader } = await import('@llm-tools/embedjs-loader-pdf').catch(() => { throw new Error('Package `@llm-tools/embedjs-loader-pdf` needs to be installed to load PDF files'); }); - createDebugMessages('embedjs:core:createLoaderFromMimeType')('Dynamically imported PdfLoader'); + createDebugMessages('embedjs:util:createLoaderFromMimeType')('Dynamically imported PdfLoader'); return new PdfLoader({ filePathOrUrl: loader }); } case 'application/vnd.openxmlformats-officedocument.presentationml.presentation': { @@ -40,18 +40,18 @@ export async function createLoaderFromMimeType(loader: string, mimeType: string) 'Package `@llm-tools/embedjs-loader-msoffice` needs to be installed to load pptx files', ); }); - createDebugMessages('embedjs:core:createLoaderFromMimeType')('Dynamically imported PptLoader'); + createDebugMessages('embedjs:util:createLoaderFromMimeType')('Dynamically imported PptLoader'); return new PptLoader({ filePathOrUrl: loader }); } case 'text/plain': { const fineType = mime.getType(loader); - createDebugMessages('embedjs:core:createLoaderFromMimeType')(`Fine type for '${loader}' is '${fineType}'`); + createDebugMessages('embedjs:util:createLoaderFromMimeType')(`Fine type for '${loader}' is '${fineType}'`); if (fineType === 'text/csv') { const { CsvLoader } = await import('@llm-tools/embedjs-loader-csv').catch(() => { throw new Error('Package `@llm-tools/embedjs-loader-csv` needs to be installed to load csv files'); }); - createDebugMessages('embedjs:core:createLoaderFromMimeType')('Dynamically imported CsvLoader'); + createDebugMessages('embedjs:util:createLoaderFromMimeType')('Dynamically imported CsvLoader'); return new CsvLoader({ filePathOrUrl: loader }); } else return new TextLoader({ text: loader }); } @@ -59,21 +59,21 @@ export async function createLoaderFromMimeType(loader: string, mimeType: string) const { CsvLoader } = await import('@llm-tools/embedjs-loader-csv').catch(() => { throw new Error('Package `@llm-tools/embedjs-loader-csv` needs to be installed to load csv files'); }); - createDebugMessages('embedjs:core:createLoaderFromMimeType')('Dynamically imported CsvLoader'); + createDebugMessages('embedjs:util:createLoaderFromMimeType')('Dynamically imported CsvLoader'); return new CsvLoader({ filePathOrUrl: loader }); } case 'text/html': { const { WebLoader } = await import('@llm-tools/embedjs-loader-web').catch(() => { throw new Error('Package `@llm-tools/embedjs-loader-web` needs to be installed to load web documents'); }); - createDebugMessages('embedjs:core:createLoaderFromMimeType')('Dynamically imported WebLoader'); + createDebugMessages('embedjs:util:createLoaderFromMimeType')('Dynamically imported WebLoader'); return new WebLoader({ urlOrContent: loader }); } case 'text/xml': { const { SitemapLoader } = await import('@llm-tools/embedjs-loader-sitemap').catch(() => { throw new Error('Package `@llm-tools/embedjs-loader-sitemap` needs to be installed to load sitemaps'); }); - createDebugMessages('embedjs:core:createLoaderFromMimeType')('Dynamically imported SitemapLoader'); + createDebugMessages('embedjs:util:createLoaderFromMimeType')('Dynamically imported SitemapLoader'); if (await SitemapLoader.test(loader)) { return new SitemapLoader({ url: loader });