Checkbox change from array to single value and value fix in html.

This commit is contained in:
2025-12-16 15:50:28 +01:00
parent bd47a194c7
commit c1e79b6603
3 changed files with 95 additions and 87 deletions
+6 -6
View File
@@ -79,27 +79,27 @@
</div> </div>
</div> </div>
<div class="step" id="step3" style="display:none;"> <div class="step" id="step3" style="display:none;">
<div class="checkbox-group"> <div class="checkbox-group">
<label id="checkbox-label" for="checkbox-group">Choose prefered document style:</label> <label id="checkbox-label" for="checkbox-group">Choose prefered document style:</label>
<div class="checkbox-container"> <div class="checkbox-container">
<input type="checkbox" name ="docFormat" id="docFormat" value="Meeting report"> <input type="checkbox" name ="docFormat" id="docFormat" value="followup-report">
<label id="label_format" for="docFormat">Follow-up Report</label> <label id="label_format" for="docFormat">Follow-up Report</label>
</div> </div>
<div class="checkbox-container"> <div class="checkbox-container">
<input type="checkbox" name="docFormat" id="docFormatSummary1" value="Summary with timestamps"> <input type="checkbox" name="docFormat" id="docFormatSummary1" value="agenda">
<label id="label_summary" for="docFormatSummary">Agenda</label> <label id="label_summary" for="docFormatSummary">Agenda</label>
</div> </div>
<div class="checkbox-container"> <div class="checkbox-container">
<input type="checkbox" name="docFormat" id="docFormatSummary2" value="Summary with timestamps"> <input type="checkbox" name="docFormat" id="docFormatSummary2" value="result-protocol">
<label id="label_summary" for="docFormatSummary">Resultprotocol</label> <label id="label_summary" for="docFormatSummary">Resultprotocol</label>
</div> </div>
<div class="checkbox-container"> <div class="checkbox-container">
<input type="checkbox" name="docFormat" id="docFormatSummary3" value="Summary with timestamps"> <input type="checkbox" name="docFormat" id="docFormatSummary3" value="sprint-planning">
<label id="label_summary" for="docFormatSummary">Sprint Planning Note</label> <label id="label_summary" for="docFormatSummary">Sprint Planning Note</label>
</div> </div>
<div class="checkbox-container"> <div class="checkbox-container">
<input type="checkbox" name="docFormat" id="docFormatCustom" value="Summary with timestamps"> <input type="checkbox" name="docFormat" id="docFormatCustom" value="custom">
<select name="ai_type" id="ai_type"> <select name="ai_type" id="ai_type">
<option>nichts</option> <option>nichts</option>
</select> </select>
+8 -10
View File
@@ -27,15 +27,13 @@ function checkBoxes() {
if(testEndings.some(e => pathToLower.endsWith(e))){ if(testEndings.some(e => pathToLower.endsWith(e))){
//assembly of the json for the main //assembly of the json for the main
const selectedStyles = [checkedCounter]; var typeCheckbox;
var iter = 0; if(document.getElementById("docFormat").checked) typeCheckbox = document.getElementById("docFormat").value;
checkboxes.forEach(function(checkbox){ if(document.getElementById("docFormatSummary1").checked) typeCheckbox = document.getElementById("docFormatSummary1").value;
if(checkbox.checked){ if(document.getElementById("docFormatSummary2").checked) typeCheckbox = document.getElementById("docFormatSummary2").value;
console.log(checkbox.value); if(document.getElementById("docFormatSummary3").checked) typeCheckbox = document.getElementById("docFormatSummary3").value;
selectedStyles[iter] = {iter: checkbox.value}; if(document.getElementById("docFormatCustom").checked) typeCheckbox = document.getElementById("docFormatCustom").value;
iter++;
}
});
document.getElementById("testy").style.visibility = "visible" document.getElementById("testy").style.visibility = "visible"
document.getElementById("box1").style.backgroundColor = "red"; document.getElementById("box1").style.backgroundColor = "red";
document.getElementById("box2").style.backgroundColor = "red"; document.getElementById("box2").style.backgroundColor = "red";
@@ -55,7 +53,7 @@ function checkBoxes() {
}, },
"document": { "document": {
"module":aiType.value, "module":aiType.value,
"styles": selectedStyles, "type": typeCheckbox,
"outputType": outputType.value "outputType": outputType.value
} }
}; };
+81 -71
View File
@@ -1,12 +1,12 @@
// Loading required packages // Loading required packages
require("./requires.js") require("./requires.js")
console.log(start); console.log(start);
// Initialising map to be used to store the functionality later on for reloadability // Initialising map to be used to store the functionality later on for reloadability
mapFunctions = new Map() mapFunctions = new Map()
// Loading the Function Map // Loading the Function Map
var path = `${mainDir}/services/modules` var path = `${mainDir}/services/modules`
var folders = fs.readdirSync(path).filter(function (file) { var folders = fs.readdirSync(path).filter(function (file) {
@@ -20,9 +20,9 @@ folders.forEach(element => {
mapFunctions.set(command.name, command); mapFunctions.set(command.name, command);
} }
}); });
// The startup information for the project, here you can add stuff that might be nice to see when the app starts // 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() mapFunctions.get("Startup_function").function()
console.log("------------------------------------ Status ------------------------------------"); console.log("------------------------------------ Status ------------------------------------");
@@ -31,37 +31,37 @@ console.log(platform);
console.log(`The Startup took ${new Date() - start}ms`) console.log(`The Startup took ${new Date() - start}ms`)
console.log(`${mapFunctions.size} Function modules loaded`); console.log(`${mapFunctions.size} Function modules loaded`);
console.log("--------------------------------------------------------------------------------"); console.log("--------------------------------------------------------------------------------");
// --------------------------------------------------------- CLI COMMANDS --------------------------------------------------------- // // --------------------------------------------------------- CLI COMMANDS --------------------------------------------------------- //
const rl = readline.createInterface({ const rl = readline.createInterface({
input: process.stdin, input: process.stdin,
output: process.stdout output: process.stdout
}); });
rl.on("line", data =>{ rl.on("line", data =>{
const args = data.trim().split(" "); const args = data.trim().split(" ");
const command = args.shift().toLowerCase(); const command = args.shift().toLowerCase();
mapFunctions.get("cliCommands").function(command, args) mapFunctions.get("cliCommands").function(command, args)
}) })
// ----------------------------------------------------------- ELECTRON ----------------------------------------------------------- // // ----------------------------------------------------------- ELECTRON ----------------------------------------------------------- //
let mainWindow; let mainWindow;
function createWindow() { function createWindow() {
mainWindow = new electron.BrowserWindow({ mainWindow = new electron.BrowserWindow({
width: 800, width: 1200,
height: 800, height: 800,
webPreferences: { webPreferences: {
nodeIntegration: false, nodeIntegration: false,
@@ -69,21 +69,21 @@ function createWindow() {
preload: `${mainDir}/electron/main/preload.js` preload: `${mainDir}/electron/main/preload.js`
} }
}); });
mainWindow.loadFile('./electron/main/index.html'); mainWindow.loadFile('./electron/main/index.html');
} }
electron.app.whenReady().then(createWindow); electron.app.whenReady().then(createWindow);
// electron.ipcMain.on("extract", (event, args) => { // electron.ipcMain.on("extract", (event, args) => {
// mapFunctions.get("extraction-video-to-audio").function(args) // mapFunctions.get("extraction-video-to-audio").function(args)
// }) // })
// setTimeout(() => { // setTimeout(() => {
// mainWindow.webContents.send("fuck", "worked uwu") // mainWindow.webContents.send("fuck", "worked uwu")
// }, 5000); // }, 5000);
electron.ipcMain.handle('get-module-names', async () => { electron.ipcMain.handle('get-module-names', async () => {
let module_array = { let module_array = {
"ai_modules":[], "ai_modules":[],
@@ -102,8 +102,8 @@ electron.ipcMain.handle('get-module-names', async () => {
// console.log(module_array); // console.log(module_array);
return module_array return module_array
}); });
// electron.ipcMain.on("get_modules", async (event, args) => { // electron.ipcMain.on("get_modules", async (event, args) => {
// let module_array = { // let module_array = {
// "ai_modules":[], // "ai_modules":[],
@@ -120,25 +120,35 @@ electron.ipcMain.handle('get-module-names', async () => {
// } // }
// }) // })
// console.log(module_array); // console.log(module_array);
// mainWindow.webContents.send("modules", module_array) // mainWindow.webContents.send("modules", module_array)
// }) // })
electron.ipcMain.on("file_submit", async (event, args) => { electron.ipcMain.on("file_submit", async (event, args) => {
try { try {
let curstep = 0 let curstep = 0
let totalsteps = 3 + args.document.styles.length let totalsteps = 4
if(args.document.styles.length == 0) const TEMPLATE_MAP = {
throw new Error("At least one Document Style needed"); "followup-report": "followup_report.txt",
"agenda": "agenda.txt",
"result-protocol": "result_protocol.txt",
"sprint-planning": "sprint_planning_note.txt",
"custom": "custom_document.txt"
};
const templateFile = TEMPLATE_MAP[args.document.type];
if (!templateFile) {
throw new Error("Unknown document type: " + args.document.type);
}
console.log(args); console.log(args);
let audiopath = "" let audiopath = ""
let transcriptpath = "" let transcriptpath = ""
console.log("\n\n Running the Video to Audio Extractor"); console.log("\n\n Running the Video to Audio Extractor");
// This code handles the Video to Audio extraction module call // This code handles the Video to Audio extraction module call
await mapFunctions.get("module-handler").function(args.video.module, {inputVideoPath: args.video.inputVideoPath, outputType: mapFunctions.get(args.transcription.module).audioformat}).then(resp => { await mapFunctions.get("module-handler").function(args.video.module, {inputVideoPath: args.video.inputVideoPath, outputType: mapFunctions.get(args.transcription.module).audioformat}).then(resp => {
@@ -150,8 +160,8 @@ electron.ipcMain.on("file_submit", async (event, args) => {
mainWindow.webContents.send("error", err) mainWindow.webContents.send("error", err)
return return
}) })
console.log("\n\n Running the Audio to Transcription module"); console.log("\n\n Running the Audio to Transcription module");
// TODO implement transcription module // TODO implement transcription module
// This code handles the Audio to Text transcription module call // This code handles the Audio to Text transcription module call
@@ -164,8 +174,8 @@ electron.ipcMain.on("file_submit", async (event, args) => {
mainWindow.webContents.send("error", err) mainWindow.webContents.send("error", err)
return return
}) })
console.log("\n\n Running the Transcription Summarizer module"); console.log("\n\n Running the Transcription Summarizer module");
// This code summarises the transcript, so that it can be used by an llm // This code summarises the transcript, so that it can be used by an llm
// await mapFunctions.get("summarize-transcription").function('A:\\programing\\@projects\\video2document\\storage\\transcripts\\IMG_2978.json').then(resp => { // await mapFunctions.get("summarize-transcription").function('A:\\programing\\@projects\\video2document\\storage\\transcripts\\IMG_2978.json').then(resp => {
@@ -178,24 +188,24 @@ electron.ipcMain.on("file_submit", async (event, args) => {
mainWindow.webContents.send("error", err) mainWindow.webContents.send("error", err)
return return
}) })
console.log("\n\n Running the LLM module"); console.log("\n\n Running the LLM module");
// TODO implement documentation module // TODO implement documentation module
// This code handles the Text to Document processing module call // This code handles the Text to Document processing module call
for (let i = 0; i < args.document.styles.length; i++) {
console.log(`\n\n Running the LLM for Document Style ${i+1}`); console.log(`\n\n Running the LLM for Document Style ${args.document.type}`);
await mapFunctions.get("module-handler").function(args.document.module, {inputTranscriptPath: transcriptpath, documentTypePath: "/Users/mikehughes/PROJ/video2document/storage/documentType/meetingReport.json", language: "en"}).then(resp => { await mapFunctions.get("module-handler").function(args.document.module, { inputTranscriptPath: transcriptpath, documentTypePath: "./storage/documentType/" + templateFile, language: "en" }).then(resp => {
console.log(resp); console.log(resp);
transcriptpath = resp transcriptpath = resp
curstep++ curstep++
mainWindow.webContents.send("progress", {curstep:curstep, totalsteps:totalsteps}) mainWindow.webContents.send("progress", { curstep: curstep, totalsteps: totalsteps })
}).catch(err => { }).catch(err => {
mainWindow.webContents.send("error", err) mainWindow.webContents.send("error", err)
return return
}) })
}
// TODO actually implement this functionality // TODO actually implement this functionality
// Module to get the first few lines for each speaker to send to the frontend // Module to get the first few lines for each speaker to send to the frontend
// await mapFunctions.get("speaker-getter-idfk").function(transcriptpath).then(resp => { // await mapFunctions.get("speaker-getter-idfk").function(transcriptpath).then(resp => {
@@ -203,7 +213,7 @@ electron.ipcMain.on("file_submit", async (event, args) => {
// transcriptpath = resp // transcriptpath = resp
// curstep++ // curstep++
// mainWindow.webContents.send("progress", {curstep:curstep, totalsteps:totalsteps}) // mainWindow.webContents.send("progress", {curstep:curstep, totalsteps:totalsteps})
// // { // // {
// // speakerA: {source: "Pfad zur Audio File"}, // // speakerA: {source: "Pfad zur Audio File"},
// // speakerB:..... // // speakerB:.....
@@ -213,15 +223,15 @@ electron.ipcMain.on("file_submit", async (event, args) => {
// mainWindow.webContents.send("error", err) // mainWindow.webContents.send("error", err)
// return // return
// }) // })
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} }
}) })
let q = let q =
{ {
video: { video: {
@@ -241,8 +251,8 @@ let q =
] ]
} }
} }
let q1 = { let q1 = {
"ai_modules": [ "ai_modules": [
{name:"abc", displayname:"ABC"}, {name:"abc", displayname:"ABC"},
@@ -252,4 +262,4 @@ let q1 = {
{name:"abc", displayname:"ABC"}, {name:"abc", displayname:"ABC"},
{name:"qeg", displayname:"aqghegahu"} {name:"qeg", displayname:"aqghegahu"}
] ]
} }