mirror of
https://github.com/Mintplex-Labs/anything-llm.git
synced 2024-11-11 01:10:11 +01:00
patch storage dirs for extensions
This commit is contained in:
parent
1aa8e5766f
commit
2d215acb75
@ -66,11 +66,17 @@ async function loadConfluence({ pageUrl, username, accessToken }) {
|
|||||||
const outFolder = slugify(
|
const outFolder = slugify(
|
||||||
`${subdomain}-confluence-${v4().slice(0, 4)}`
|
`${subdomain}-confluence-${v4().slice(0, 4)}`
|
||||||
).toLowerCase();
|
).toLowerCase();
|
||||||
const outFolderPath = path.resolve(
|
|
||||||
|
const outFolderPath =
|
||||||
|
process.env.NODE_ENV === "development"
|
||||||
|
? path.resolve(
|
||||||
__dirname,
|
__dirname,
|
||||||
`../../../../server/storage/documents/${outFolder}`
|
`../../../../server/storage/documents/${outFolder}`
|
||||||
);
|
)
|
||||||
fs.mkdirSync(outFolderPath);
|
: path.resolve(process.env.STORAGE_DIR, `documents/${outFolder}`);
|
||||||
|
|
||||||
|
if (!fs.existsSync(outFolderPath))
|
||||||
|
fs.mkdirSync(outFolderPath, { recursive: true });
|
||||||
|
|
||||||
docs.forEach((doc) => {
|
docs.forEach((doc) => {
|
||||||
const data = {
|
const data = {
|
||||||
|
@ -31,11 +31,17 @@ async function loadGithubRepo(args) {
|
|||||||
const outFolder = slugify(
|
const outFolder = slugify(
|
||||||
`${repo.author}-${repo.project}-${repo.branch}-${v4().slice(0, 4)}`
|
`${repo.author}-${repo.project}-${repo.branch}-${v4().slice(0, 4)}`
|
||||||
).toLowerCase();
|
).toLowerCase();
|
||||||
const outFolderPath = path.resolve(
|
|
||||||
|
const outFolderPath =
|
||||||
|
process.env.NODE_ENV === "development"
|
||||||
|
? path.resolve(
|
||||||
__dirname,
|
__dirname,
|
||||||
`../../../../server/storage/documents/${outFolder}`
|
`../../../../server/storage/documents/${outFolder}`
|
||||||
);
|
)
|
||||||
fs.mkdirSync(outFolderPath);
|
: path.resolve(process.env.STORAGE_DIR, `documents/${outFolder}`);
|
||||||
|
|
||||||
|
if (!fs.existsSync(outFolderPath))
|
||||||
|
fs.mkdirSync(outFolderPath, { recursive: true });
|
||||||
|
|
||||||
for (const doc of docs) {
|
for (const doc of docs) {
|
||||||
if (!doc.pageContent) continue;
|
if (!doc.pageContent) continue;
|
||||||
|
@ -67,11 +67,17 @@ async function loadYouTubeTranscript({ url }) {
|
|||||||
const outFolder = slugify(
|
const outFolder = slugify(
|
||||||
`${metadata.author} YouTube transcripts`
|
`${metadata.author} YouTube transcripts`
|
||||||
).toLowerCase();
|
).toLowerCase();
|
||||||
const outFolderPath = path.resolve(
|
|
||||||
|
const outFolderPath =
|
||||||
|
process.env.NODE_ENV === "development"
|
||||||
|
? path.resolve(
|
||||||
__dirname,
|
__dirname,
|
||||||
`../../../../server/storage/documents/${outFolder}`
|
`../../../../server/storage/documents/${outFolder}`
|
||||||
);
|
)
|
||||||
if (!fs.existsSync(outFolderPath)) fs.mkdirSync(outFolderPath);
|
: path.resolve(process.env.STORAGE_DIR, `documents/${outFolder}`);
|
||||||
|
|
||||||
|
if (!fs.existsSync(outFolderPath))
|
||||||
|
fs.mkdirSync(outFolderPath, { recursive: true });
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
id: v4(),
|
id: v4(),
|
||||||
|
Loading…
Reference in New Issue
Block a user