feat: Add .env.example configuration file and integrate Redis service into Docker Compose for improved task management. Update desktop application to support document indexing and extraction workflows, enhancing user experience with a new extraction wizard and stepper components. Revise README and documentation for clarity on setup and usage.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
const { app, BrowserWindow, dialog, ipcMain } = require("electron");
|
||||
const fs = require("node:fs/promises");
|
||||
const path = require("node:path");
|
||||
const { indexFolder } = require("./folderIndex.cjs");
|
||||
|
||||
const DOCUMENT_EXTENSIONS = new Set([".pdf", ".tif", ".tiff", ".png", ".jpg", ".jpeg"]);
|
||||
|
||||
@@ -72,6 +73,20 @@ ipcMain.handle("fs:first-document", async (_event, rootPath, keywords) => {
|
||||
return matches[0] || null;
|
||||
});
|
||||
|
||||
ipcMain.handle("fs:index-folder", async (_event, rootPath, structureMode, docTypes, keywords) => {
|
||||
if (!rootPath) return [];
|
||||
return indexFolder(rootPath, structureMode, Array.isArray(docTypes) ? docTypes : [], Array.isArray(keywords) ? keywords : []);
|
||||
});
|
||||
|
||||
ipcMain.handle("fs:read-file", async (_event, filePath) => {
|
||||
const buffer = await fs.readFile(filePath);
|
||||
return {
|
||||
filename: path.basename(filePath),
|
||||
size: buffer.byteLength,
|
||||
data: buffer,
|
||||
};
|
||||
});
|
||||
|
||||
async function findDocuments(rootPath, keywords) {
|
||||
const normalizedKeywords = keywords
|
||||
.map((item) => String(item || "").trim().toLowerCase())
|
||||
|
||||
Reference in New Issue
Block a user