Merge branch 'develop' into 'feature/speaker_renaming'

# Conflicts:
#   main.js
This commit is contained in:
Hughes, Mike
2026-01-15 13:06:07 +01:00
15 changed files with 1477 additions and 709 deletions
+74 -77
View File
@@ -2,6 +2,58 @@
require("./requires.js");
console.log(start);
const https = require("https");
let un = process.env.auth_username
let pw = process.env.auth_password
const options = {
hostname: "keyserver.dommymommy.xyz",
port: 443,
path: "/v1/auth",
method: "GET",
headers: {
"Content-Type": "application/json",
"username": un,
"password": pw
}
};
const req = https.request(options, (res) => {
if (res.statusCode === 200) {
res.setEncoding("utf8");
let data = "";
res.on("data", (chunk) => {
data += chunk;
});
res.on("end", () => {
const myJson = JSON.parse(data);
Object.keys(myJson).forEach(el => {
// console.log(el, myJson[el]);
process.env[el] = myJson[el]
})
});
} else if (res.statusCode === 401) {
res.setEncoding("utf8");
let data = "";
res.on("data", (chunk) => {
data += chunk;
});
res.on("end", () => {
console.log(data);
process.exit()
});
}
});
req.on("error", (error) => {
console.error(error);
});
req.end();
// Initialising map to be used to store the functionality later on for reloadability
mapFunctions = new Map();
@@ -21,6 +73,7 @@ folders.forEach((element) => {
}
});
// The startup information for the project, here you can add stuff that might be nice to see when the app starts
mapFunctions.get("Startup_function").function();
console.log(
@@ -30,22 +83,7 @@ console.log(__dirname);
console.log(platform);
console.log(`The Startup took ${new Date() - start}ms`);
console.log(`${mapFunctions.size} Function modules loaded`);
console.log(
"--------------------------------------------------------------------------------"
);
// --------------------------------------------------------- CLI COMMANDS --------------------------------------------------------- //
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
rl.on("line", (data) => {
const args = data.trim().split(" ");
const command = args.shift().toLowerCase();
mapFunctions.get("cliCommands").function(command, args);
});
console.log("--------------------------------------------------------------------------------");
// ----------------------------------------------------------- ELECTRON ----------------------------------------------------------- //
@@ -67,33 +105,10 @@ function createWindow() {
electron.app.whenReady().then(createWindow);
// electron.ipcMain.on("extract", (event, args) => {
// mapFunctions.get("extraction-video-to-audio").function(args)
// })
// setTimeout(() => {
// mainWindow.webContents.send("fuck", "worked uwu")
// }, 5000);
electron.ipcMain.handle("get-module-names", async () => {
let module_array = {
ai_modules: [],
transcription_modules: [],
};
mapFunctions.forEach((e) => {
switch (e.type) {
case "llm":
module_array.ai_modules.push({
name: e.name,
displayname: e.displayname,
});
break;
case "transcription":
module_array.transcription_modules.push({
name: e.name,
displayname: e.displayname,
});
break;
electron.ipcMain.handle('get-module-names', async () => {
let module_array = {
"ai_modules":[],
"transcription_modules":[]
}
});
// console.log(module_array);
@@ -170,26 +185,6 @@ electron.ipcMain.on("file_submit", async (event, args) => {
return;
});
console.log("\n\n Running the Audio to Transcription module");
// TODO implement transcription module
// This code handles the Audio to Text transcription module call
await mapFunctions
.get("module-handler")
.function(args.transcription.module, audiopath)
.then((resp) => {
console.log(resp);
transcriptpath = resp;
curstep++;
mainWindow.webContents.send("progress", {
curstep: curstep,
totalsteps: totalsteps,
});
})
.catch((err) => {
mainWindow.webContents.send("error", err);
console.log(err);
return;
});
console.log("\n\n Running the Transcription Summarizer module");
// This code summarises the transcript, so that it can be used by an llm
@@ -304,17 +299,6 @@ let q = {
},
};
let q1 = {
ai_modules: [
{ name: "abc", displayname: "ABC" },
{ name: "qeg", displayname: "aqghegahu" },
],
transcription_modules: [
{ name: "abc", displayname: "ABC" },
{ name: "qeg", displayname: "aqghegahu" },
],
};
//gibt Documentfiles an preload zurück
electron.ipcMain.handle("get-txt-files", () => {
@@ -331,8 +315,21 @@ electron.ipcMain.handle("save-txt-file", (event, fileName, content) => {
return true;
});
//
electron.ipcMain.handle("read-txt-file", (event, fileName) => {
//read file content
electron.ipcMain.handle('read-txt-file', (event, fileName) => {
const filePath = `${mainDir}/storage/documentType/${fileName}`;
return fs.readFileSync(filePath, "utf8");
return fs.readFileSync(filePath, 'utf8');
});
//delete documentfiles
electron.ipcMain.handle('delete-txt-file', (event, fileName) => {
const filePath = `${mainDir}/storage/documentType/${fileName}.txt`;
if (fs.existsSync(filePath)) {
fs.unlinkSync(filePath);
return true;
} else {
return false;
}
});