mirror of
https://github.com/khoj-ai/khoj.git
synced 2025-02-17 08:04:21 +00:00
Use built-in app.vault to determine whether there are any PDF files within
This commit is contained in:
parent
eff1436857
commit
a52c1c8380
1 changed files with 2 additions and 3 deletions
|
@ -1,6 +1,5 @@
|
|||
import { FileSystemAdapter, Notice, RequestUrlParam, request, Vault, Modal } from 'obsidian';
|
||||
import { KhojSetting } from 'src/settings'
|
||||
import * as fs from 'fs';
|
||||
|
||||
export function getVaultAbsolutePath(vault: Vault): string {
|
||||
let adaptor = vault.adapter;
|
||||
|
@ -111,9 +110,9 @@ export async function configureKhojBackend(vault: Vault, setting: KhojSetting, n
|
|||
data["content-type"]["pdf"]["input-filter"].length != 1 ||
|
||||
data["content-type"]["pdf"]["input-filter"][0] !== pdfInVault)) {
|
||||
|
||||
let pdfs = fs.readdirSync(vaultPath).filter(file => file.endsWith(".pdf"));
|
||||
let hasPdfFiles = app.vault.getFiles().some(file => file.extension === 'pdf');
|
||||
|
||||
if (pdfs.length > 0) {
|
||||
if (hasPdfFiles) {
|
||||
// Update pdf config in khoj content-type config
|
||||
// Set pdf config to only index pdf files in configured obsidian vault
|
||||
let khojPdfIndexDirectory = getIndexDirectoryFromBackendConfig(data["content-type"]["pdf"]["embeddings-file"]);
|
||||
|
|
Loading…
Add table
Reference in a new issue