Merge commit '6531f5f51c125b9cef761b457ab09f494c77a7e7' into feature/modular-ipc-system-implementation

This commit is contained in:
2025-11-24 12:56:21 +01:00
3 changed files with 30 additions and 44 deletions
+14 -25
View File
@@ -5,39 +5,28 @@ try {
onFileDrop: (file) => webUtils.getPathForFile(file) onFileDrop: (file) => webUtils.getPathForFile(file)
}) })
contextBridge.exposeInMainWorld("extractor", { contextBridge.exposeInMainWorld("extractor", {
extract: (file) => { // extract: (file) => {ipcRenderer.send("file_submit", q)}
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", { contextBridge.exposeInMainWorld("electronAPI", {
getFilePath: (file) => {return webUtils.getPathForFile(file)} getFilePath: (file) => {return webUtils.getPathForFile(file)}
}) })
contextBridge.exposeInMainWorld("onStartup", {
getModuleNames: (file) => { ipcRenderer.send("get_modules", "")}
})
ipcRenderer.on("progress", (event, resp) => { ipcRenderer.on("progress", (event, resp) => {
alert(`Finished step ${resp.curstep} of ${resp.totalsteps}`) alert(`Finished step ${resp.curstep} of ${resp.totalsteps}`)
}) })
ipcRenderer.on("error", (event, err) => {alert(err)}) ipcRenderer.on("error", (event, err) => {alert(err)})
ipcRenderer.on("modules", (event, resp) => {
loadAiOptions(resp.ai_modules);
loadTranscriptionOptions(resp.transcription_modules);
})
} catch (error) { } catch (error) {
console.log("Error in preload.js"); console.log("Error in preload.js");
} }
+8 -7
View File
@@ -32,13 +32,14 @@ uploadContainer.addEventListener("drop", (e) => {
}) })
window.addEventListener('load', (e) => { window.addEventListener('load', (e) => {
try { try {
console.log("test"); console.log("test");
loadLanguageOptions(); loadLanguageOptions();
} catch (error) { window.onStartup.getModuleNames();
} catch (error) {
}
}
}); });
+8 -12
View File
@@ -55,11 +55,7 @@ function checkBoxes() {
"style": selectedStyles "style": selectedStyles
} }
}; };
console.log(sendingPackage); ipcRenderer.send("file_submit", sendingPackage)
//window.extractor.extract({inputVideoPath: pathTest, outputType:"wav"});
}else{ }else{
alert('The given file is not compatible. These are the available types: [".mp4", ".mov", ".avi", ".mkv"].'); alert('The given file is not compatible. These are the available types: [".mp4", ".mov", ".avi", ".mkv"].');
} }
@@ -137,11 +133,11 @@ function loadAiOptions(options){
var menu = document.getElementById('ai_type'); var menu = document.getElementById('ai_type');
var object_holdy; var object_holdy;
var choice ; var choice ;
object_holdy = Object.keys(options); object_holdy = options
for(i = 0; i < options.length; i++){ for(i = 0; i < options.length; i++){
choice = document.createElement('option'); choice = document.createElement('option');
choice.textContent = object_holdy[i]; choice.textContent = object_holdy[i].displayname;
choice.value = object_holdy[i]; choice.value = object_holdy[i].name;
menu.appendChild(choice); menu.appendChild(choice);
} }
} catch (error) { } catch (error) {
@@ -153,14 +149,14 @@ function loadAiOptions(options){
//function to load transcription options to the drop down list //function to load transcription options to the drop down list
function loadTranscriptionOptions(options){ function loadTranscriptionOptions(options){
try { try {
var menu = document.getElementById('transkript_type'); var menu = document.getElementById('ai_type');
var object_holdy; var object_holdy;
var choice ; var choice ;
object_holdy = Object.keys(options); object_holdy = options
for(i = 0; i < options.length; i++){ for(i = 0; i < options.length; i++){
choice = document.createElement('option'); choice = document.createElement('option');
choice.textContent = object_holdy[i]; choice.textContent = object_holdy[i].displayname;
choice.value = object_holdy[i]; choice.value = object_holdy[i].name;
menu.appendChild(choice); menu.appendChild(choice);
} }
} catch (error) { } catch (error) {