mirror of
https://github.com/Mintplex-Labs/anything-llm.git
synced 2025-04-17 18:18:11 +00:00
hoist var in extensions
This commit is contained in:
parent
31ff4f0832
commit
daadad3859
8 changed files with 9 additions and 11 deletions
collector
processLink/convert
processSingleFile
|
@ -18,7 +18,7 @@ async function scrapeGenericUrl(link) {
|
|||
const url = new URL(link);
|
||||
const filename = (url.host + "-" + url.pathname).replace(".", "_");
|
||||
|
||||
data = {
|
||||
const data = {
|
||||
id: v4(),
|
||||
url: "file://" + slugify(filename) + ".html",
|
||||
title: slugify(filename) + ".html",
|
||||
|
|
|
@ -46,7 +46,7 @@ async function asAudio({ fullFilePath = "", filename = "" }) {
|
|||
return { success: false, reason: `No text content found in ${filename}.` };
|
||||
}
|
||||
|
||||
data = {
|
||||
const data = {
|
||||
id: v4(),
|
||||
url: "file://" + fullFilePath,
|
||||
title: filename,
|
||||
|
|
|
@ -28,7 +28,7 @@ async function asDocX({ fullFilePath = "", filename = "" }) {
|
|||
}
|
||||
|
||||
const content = pageContent.join("");
|
||||
data = {
|
||||
const data = {
|
||||
id: v4(),
|
||||
url: "file://" + fullFilePath,
|
||||
title: filename,
|
||||
|
|
|
@ -35,7 +35,7 @@ async function asMbox({ fullFilePath = "", filename = "" }) {
|
|||
`-- Working on message "${mail.subject || "Unknown subject"}" --`
|
||||
);
|
||||
|
||||
data = {
|
||||
const data = {
|
||||
id: v4(),
|
||||
url: "file://" + fullFilePath,
|
||||
title: mail?.subject
|
||||
|
|
|
@ -23,7 +23,7 @@ async function asOfficeMime({ fullFilePath = "", filename = "" }) {
|
|||
return { success: false, reason: `No text content found in ${filename}.` };
|
||||
}
|
||||
|
||||
data = {
|
||||
const data = {
|
||||
id: v4(),
|
||||
url: "file://" + fullFilePath,
|
||||
title: filename,
|
||||
|
|
|
@ -18,8 +18,7 @@ async function asPDF({ fullFilePath = "", filename = "" }) {
|
|||
const docs = await pdfLoader.load();
|
||||
for (const doc of docs) {
|
||||
console.log(
|
||||
`-- Parsing content from pg ${
|
||||
doc.metadata?.loc?.pageNumber || "unknown"
|
||||
`-- Parsing content from pg ${doc.metadata?.loc?.pageNumber || "unknown"
|
||||
} --`
|
||||
);
|
||||
if (!doc.pageContent.length) continue;
|
||||
|
@ -33,7 +32,7 @@ async function asPDF({ fullFilePath = "", filename = "" }) {
|
|||
}
|
||||
|
||||
const content = pageContent.join("");
|
||||
data = {
|
||||
const data = {
|
||||
id: v4(),
|
||||
url: "file://" + fullFilePath,
|
||||
title: docs[0]?.metadata?.pdf?.info?.Title || filename,
|
||||
|
|
|
@ -23,7 +23,7 @@ async function asTxt({ fullFilePath = "", filename = "" }) {
|
|||
}
|
||||
|
||||
console.log(`-- Working ${filename} --`);
|
||||
data = {
|
||||
const data = {
|
||||
id: v4(),
|
||||
url: "file://" + fullFilePath,
|
||||
title: filename,
|
||||
|
|
|
@ -5,8 +5,7 @@ const {
|
|||
SUPPORTED_FILETYPE_CONVERTERS,
|
||||
} = require("../utils/constants");
|
||||
const { trashFile } = require("../utils/files");
|
||||
|
||||
RESERVED_FILES = ["__HOTDIR__.md"];
|
||||
const RESERVED_FILES = ["__HOTDIR__.md"];
|
||||
|
||||
async function processSingleFile(targetFilename) {
|
||||
const fullFilePath = path.resolve(WATCH_DIRECTORY, targetFilename);
|
||||
|
|
Loading…
Add table
Reference in a new issue