implemented first version of the modular IPC system

This commit is contained in:
2025-11-17 18:00:04 +01:00
parent 4b72568ad3
commit 4dc53b9d5f
5 changed files with 149 additions and 18 deletions
+29 -1
View File
@@ -5,11 +5,39 @@ try {
onFileDrop: (file) => webUtils.getPathForFile(file)
})
contextBridge.exposeInMainWorld("extractor", {
extract: (file) => ipcRenderer.send("extract", file)
extract: (file) => {
let q = // TODO get rid of this example code and have the actual json object be sent
{
video: {
module: "extraction-video-to-audio", // The name of the module, idk if we ever implement other extraction modules, the default one is extraction-video-to-audio
inputVideoPath: file.inputVideoPath, // See script.js on line 27 for an example of what this should look like
outputType: file.outputType // The file format to be used for the audio output file, such as wav, mp3, flac and so on
},
transcription:{
module: "String" // The module name of the transcription model you want to use
},
document:{
module: "String", // The module name of the AI model you want to use to create the document
styles: [ // An array of all the document styles/prompts you want to have the document be processed with
{
prompt: "String",
}
]
}
}
// ipcRenderer.send("file_submit", {module:"extraction-video-to-audio", parameter:file})
ipcRenderer.send("file_submit", q)
}
})
contextBridge.exposeInMainWorld("electronAPI", {
getFilePath: (file) => {return webUtils.getPathForFile(file)}
})
ipcRenderer.on("progress", (event, resp) => {
alert(`Finished step ${resp.curstep} of ${resp.totalsteps}`)
})
ipcRenderer.on("error", (event, err) => {alert(err)})
} catch (error) {
console.log("Error in preload.js");
}