Switched to transcription summarizer2 due to a better output format

This commit is contained in:
2025-11-24 17:01:49 +01:00
parent 9dfc05e987
commit 9a0a349813
2 changed files with 99 additions and 88 deletions
+1 -1
View File
@@ -169,7 +169,7 @@ electron.ipcMain.on("file_submit", async (event, args) => {
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 => {
await mapFunctions.get("summarize-transcription").function(transcriptpath).then(resp => { await mapFunctions.get("summarize-transcription2").function(transcriptpath).then(resp => {
console.log(resp); console.log(resp);
transcriptpath = resp transcriptpath = resp
curstep++ curstep++
@@ -14,6 +14,7 @@ module.exports = {
type: "summarizer", // 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 displayname: "Summarizer", // The displayname used within the UI
async function(args) { async function(args) {
return new Promise(async (resolve, reject) => {
let inputJson = args.json; let inputJson = args.json;
//JSON Path //JSON Path
@@ -27,11 +28,18 @@ module.exports = {
} }
} }
// JSON parsen // JSON parsen
if (typeof inputJson === "string") { if (typeof args === "string") {
try { try {
inputJson = JSON.parse(inputJson); await new Promise((res) => {
fs.readFile(args, 'utf8', function (err, data) {
if (err) throw err;
inputJson = JSON.parse(data);
res()
});
})
} catch (e) { } catch (e) {
console.log("Invalid JSON in summarize-transcription"); console.log("Invalid JSON in summarize-transcription");
console.log(e)
return { error: "Invalid JSON" }; return { error: "Invalid JSON" };
} }
} }
@@ -114,8 +122,11 @@ module.exports = {
fs.writeFileSync(txtPath, output.join("\n"), "utf-8"); fs.writeFileSync(txtPath, output.join("\n"), "utf-8");
console.log(`Summary successfully saved:\n- ${jsonPath}\n- ${txtPath}`); console.log(`Summary successfully saved:\n- ${jsonPath}\n- ${txtPath}`);
resolve(jsonPath);
} catch (err) { } catch (err) {
console.error("Error saving Summary:", err); console.error("Error saving Summary:", err);
} reject(err);
}
})
} }
} }