diff --git a/electron/main/preload.js b/electron/main/preload.js index ec7ff05..e2353c7 100644 --- a/electron/main/preload.js +++ b/electron/main/preload.js @@ -12,6 +12,9 @@ try { contextBridge.exposeInMainWorld("electronAPI", { getFilePath: (file) => {return webUtils.getPathForFile(file)} }) + contextBridge.exposeInMainWorld("summarizer", { + runFile: (file) => ipcRenderer.send("summarize-transcription", file) + }); } catch (error) { console.log("Error in preload.js"); } diff --git a/main.js b/main.js index 1482f06..38137b6 100644 --- a/main.js +++ b/main.js @@ -76,4 +76,9 @@ electron.app.whenReady().then(createWindow); electron.ipcMain.on("extract", (event, args) => { mapFunctions.get("extraction-video-to-audio").function(args) -}) \ No newline at end of file +}) + +electron.ipcMain.on("summarize-transcription", (event, args) => { + mapFunctions.get("summarize-transcription").function(args); +}); + diff --git a/services/modules/jsonTools/transcriptionSummarizer.js b/services/modules/jsonTools/transcriptionSummarizer.js index dae3537..ea1025c 100644 --- a/services/modules/jsonTools/transcriptionSummarizer.js +++ b/services/modules/jsonTools/transcriptionSummarizer.js @@ -6,11 +6,21 @@ if (!fs.existsSync(outputDir)) { module.exports = { name: "summarize-transcription", // Unique name for our function that will later be used to get the function from the map via "mapFunctions.get("example").function()" - type: "transcription", // value used to differentiate each module to order them in the UI + type: "summarizer", // value used to differentiate each module to order them in the UI displayname: "Summarizer", // The displayname used within the UI async function(args) { let inputJson = args.json; + //JSON Path + if (args.jsonPath) { + try { + const raw = fs.readFileSync(args.jsonPath, "utf-8"); + inputJson = JSON.parse(raw); + } catch (e) { + console.error("Failed to load JSON from file:", e); + return { error: "Could not read JSON from file path." }; + } + } // JSON parsen if (typeof inputJson === "string") { try {