Einbindung des Summarizer

This commit is contained in:
santa
2025-11-20 11:51:34 +01:00
parent 455147a41b
commit 97b571b7f9
3 changed files with 20 additions and 2 deletions
+3
View File
@@ -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");
}
+5
View File
@@ -77,3 +77,8 @@ electron.app.whenReady().then(createWindow);
electron.ipcMain.on("extract", (event, args) => {
mapFunctions.get("extraction-video-to-audio").function(args)
})
electron.ipcMain.on("summarize-transcription", (event, args) => {
mapFunctions.get("summarize-transcription").function(args);
});
@@ -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 {