mirror of
https://gitlab.rlp.net/proj-wise2526-video2document/video2document.git
synced 2026-06-15 18:01:52 +02:00
Merge branch 'develop' into 'feature/ui-test'
Getting the ui-test up to date See merge request proj-wise2526-video2document/video2document!69
This commit is contained in:
@@ -24,4 +24,5 @@ job-test:
|
|||||||
- npm install
|
- npm install
|
||||||
- echo "ASSEMBLYAI_API_KEY=$apikey_assembly" > .env
|
- echo "ASSEMBLYAI_API_KEY=$apikey_assembly" > .env
|
||||||
- echo "GOOGLE_API_KEY=$apikey_gemini" >> .env
|
- echo "GOOGLE_API_KEY=$apikey_gemini" >> .env
|
||||||
|
- echo "SAIA_API_KEY=$apikey_saia" >> .env
|
||||||
- npm test
|
- npm test
|
||||||
@@ -198,40 +198,23 @@ electron.ipcMain.on("file_submit", async (event, args) => {
|
|||||||
console.log(`\n\n Running the LLM for Document Style ${args.document.type}`);
|
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: "./storage/documentType/" + templateFile, 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);
|
||||||
globalFinalHtmlPath = resp
|
globalFinalHtmlPath = 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
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
await mapFunctions.get("extract-speaker-snippets").function({audioPath: audiopath, jsonPath: transcriptpath }).then(resp => {
|
await mapFunctions.get("extract-speaker-snippets").function({audioPath: audiopath, jsonPath: transcriptpath }).then(resp => {
|
||||||
mainWindow.webContents.send("submitSpeaker", resp)
|
mainWindow.webContents.send("submitSpeaker", resp)
|
||||||
console.log(resp)
|
console.log(resp)
|
||||||
|
}).catch(err => {
|
||||||
|
mainWindow.webContents.send("error", err)
|
||||||
|
return
|
||||||
})
|
})
|
||||||
|
|
||||||
// TODO actually implement this functionality
|
|
||||||
// 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 => {
|
|
||||||
// console.log(resp);
|
|
||||||
// transcriptpath = resp
|
|
||||||
// curstep++
|
|
||||||
// mainWindow.webContents.send("progress", {curstep:curstep, totalsteps:totalsteps})
|
|
||||||
|
|
||||||
// // {
|
|
||||||
// // speakerA: {source: "Pfad zur Audio File"},
|
|
||||||
// // speakerB:.....
|
|
||||||
// // }
|
|
||||||
// mainWindow.webContents.send("speakers", {speakerA:"pfad1", speakerB:"pfad2"})
|
|
||||||
// }).catch(err => {
|
|
||||||
// mainWindow.webContents.send("error", err)
|
|
||||||
// return
|
|
||||||
// })
|
|
||||||
|
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ module.exports = {
|
|||||||
|
|
||||||
let output = {}
|
let output = {}
|
||||||
|
|
||||||
console.log("Extract Speaker Snippets\n");
|
// console.log("Extract Speaker Snippets\n");
|
||||||
|
|
||||||
// Pfade
|
// Pfade
|
||||||
const AUDIO_PATH = parameter.audioPath; // Gesamt-Audio
|
const AUDIO_PATH = parameter.audioPath; // Gesamt-Audio
|
||||||
@@ -23,7 +23,8 @@ module.exports = {
|
|||||||
|
|
||||||
|
|
||||||
if (!AUDIO_PATH || !JSON_PATH) {
|
if (!AUDIO_PATH || !JSON_PATH) {
|
||||||
console.error("no audioPath or jsonPath available");
|
// console.error("no audioPath or jsonPath available");
|
||||||
|
reject(new Error("no audioPath or jsonPath available"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,12 +38,14 @@ module.exports = {
|
|||||||
try {
|
try {
|
||||||
entries = JSON.parse(fs.readFileSync(JSON_PATH, "utf8"));
|
entries = JSON.parse(fs.readFileSync(JSON_PATH, "utf8"));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("JSON reading failed", err);
|
// console.error("JSON reading failed", err);
|
||||||
|
reject(new Error(err));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Array.isArray(entries)) {
|
if (!Array.isArray(entries)) {
|
||||||
console.error("JSON is not an Array");
|
// console.error("JSON is not an Array");
|
||||||
|
reject(new Error("JSON is not an Array"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,32 +67,36 @@ module.exports = {
|
|||||||
const durationSec = (data.end - data.start) / 1000;
|
const durationSec = (data.end - data.start) / 1000;
|
||||||
|
|
||||||
if (durationSec <= 0) {
|
if (durationSec <= 0) {
|
||||||
console.log(`invalid times for Speaker ${speaker}`);
|
// console.log(`invalid times for Speaker ${speaker}`);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const outFile = path.join(OUTPUT_DIR, `speaker_${speaker}.wav`);
|
const outFile = path.join(OUTPUT_DIR, `speaker_${speaker}.wav`);
|
||||||
|
try {
|
||||||
await new Promise((res, rej) => {
|
await new Promise((res, rej) => {
|
||||||
ffmpeg(AUDIO_PATH)
|
ffmpeg(AUDIO_PATH)
|
||||||
.setStartTime(startSec)
|
.setStartTime(startSec)
|
||||||
.setDuration(durationSec)
|
.setDuration(durationSec)
|
||||||
.output(outFile)
|
.output(outFile)
|
||||||
.on("end", () => {
|
.on("end", () => {
|
||||||
output[`speaker${speaker}`] = {src: outFile, name: `speaker${speaker}`}
|
output[`speaker${speaker}`] = {src: outFile, name: `speaker${speaker}`}
|
||||||
console.log(`Snippet erstellt: speaker_${speaker}.wav`);
|
// console.log(`Snippet erstellt: speaker_${speaker}.wav`);
|
||||||
res();
|
res();
|
||||||
})
|
})
|
||||||
.on("error", (err) => {
|
.on("error", (err) => {
|
||||||
console.error(`FFmpeg Fehler (${speaker})`, err.message);
|
// console.error(`FFmpeg Fehler (${speaker})`, err.message);
|
||||||
rej();
|
rej(err);
|
||||||
})
|
return
|
||||||
.run();
|
})
|
||||||
});
|
.run();
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
reject(error)
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
resolve(output)
|
resolve(output)
|
||||||
console.log("\nAlle Speaker-Snippets erstellt\n");
|
// console.log("\nAlle Speaker-Snippets erstellt\n");
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
const fs = require('fs');
|
// const fs = require('fs');
|
||||||
const path = require('path');
|
// const path = require('path');
|
||||||
|
|
||||||
const outputDir = path.join(__dirname, "../../../storage/documents"); // path for output directory
|
const outputDir = path.join(__dirname, "../../../storage/documents"); // path for output directory
|
||||||
|
|
||||||
@@ -43,6 +43,7 @@ const module_exports = {
|
|||||||
const documentType = await fs.promises.readFile(documentTypePath, "utf-8"); //read document type from Path
|
const documentType = await fs.promises.readFile(documentTypePath, "utf-8"); //read document type from Path
|
||||||
const promptText = `${documentType}, in language ${language}, transcript:\n\n${transcript}`; //combine doc type, language and transcript - Change prompt here if needed
|
const promptText = `${documentType}, in language ${language}, transcript:\n\n${transcript}`; //combine doc type, language and transcript - Change prompt here if needed
|
||||||
|
|
||||||
|
// return
|
||||||
// --- REST CALL ---
|
// --- REST CALL ---
|
||||||
const response = await fetch(SAIA_URL, { //safe model response in variable
|
const response = await fetch(SAIA_URL, { //safe model response in variable
|
||||||
method: "POST",
|
method: "POST",
|
||||||
|
|||||||
@@ -21,5 +21,6 @@ STIL:
|
|||||||
- Klar, kompakt
|
- Klar, kompakt
|
||||||
- Business-orientiert
|
- Business-orientiert
|
||||||
- Keine Sprecher- oder Zeitangaben
|
- Keine Sprecher- oder Zeitangaben
|
||||||
|
- Namen aus dem Transkript speakerA, speakerB etc. sollen weiterhin bestehen bleiben wie sie sind und nicht im Dokument ersetzt werden
|
||||||
|
|
||||||
TRANSKRIPT:
|
TRANSKRIPT:
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ WICHTIG:
|
|||||||
- Nutze das Transkript als Wissensquelle
|
- Nutze das Transkript als Wissensquelle
|
||||||
- Struktur, Tonalität und Detailgrad anpassen
|
- Struktur, Tonalität und Detailgrad anpassen
|
||||||
- Inhalte logisch zusammenführen
|
- Inhalte logisch zusammenführen
|
||||||
|
- Namen aus dem Transkript speakerA, speakerB etc. sollen weiterhin bestehen bleiben wie sie sind und nicht im Dokument ersetzt werden
|
||||||
|
|
||||||
FORMAT:
|
FORMAT:
|
||||||
- Passe Struktur und Stil an den Nutzerwunsch an
|
- Passe Struktur und Stil an den Nutzerwunsch an
|
||||||
|
|||||||
+1
@@ -11,6 +11,7 @@ ANFORDERUNGEN:
|
|||||||
- Keine Zeitstempel oder Sprecher-Namen zitieren
|
- Keine Zeitstempel oder Sprecher-Namen zitieren
|
||||||
- Leite Entscheidungen und Aufgaben logisch ab, wenn sie implizit sind
|
- Leite Entscheidungen und Aufgaben logisch ab, wenn sie implizit sind
|
||||||
- Markiere offene Punkte klar
|
- Markiere offene Punkte klar
|
||||||
|
- Namen aus dem Transkript speakerA, speakerB etc. sollen weiterhin bestehen bleiben wie sie sind und nicht im Dokument ersetzt werden
|
||||||
|
|
||||||
STRUKTUR DES DOKUMENTS:
|
STRUKTUR DES DOKUMENTS:
|
||||||
1. Titel & Metadaten
|
1. Titel & Metadaten
|
||||||
@@ -21,5 +21,7 @@ REGELN:
|
|||||||
- Keine Meinungen oder Spekulationen
|
- Keine Meinungen oder Spekulationen
|
||||||
- Keine Zeit- oder Sprecherangaben
|
- Keine Zeit- oder Sprecherangaben
|
||||||
- Sachlich, formal
|
- Sachlich, formal
|
||||||
|
- Namen aus dem Transkript speakerA, speakerB etc. sollen weiterhin bestehen bleiben wie sie sind und nicht im Dokument ersetzt werden
|
||||||
|
|
||||||
|
|
||||||
TRANSKRIPT:
|
TRANSKRIPT:
|
||||||
|
|||||||
@@ -30,5 +30,6 @@ STIL:
|
|||||||
- Agile-konform
|
- Agile-konform
|
||||||
- Klar & umsetzungsorientiert
|
- Klar & umsetzungsorientiert
|
||||||
- Bullet Points bevorzugen
|
- Bullet Points bevorzugen
|
||||||
|
- Namen aus dem Transkript speakerA, speakerB etc. sollen weiterhin bestehen bleiben wie sie sind und nicht im Dokument ersetzt werden
|
||||||
|
|
||||||
TRANSKRIPT:
|
TRANSKRIPT:
|
||||||
|
|||||||
+89
-16
@@ -21,6 +21,7 @@ let audiopath
|
|||||||
let transcriptPath
|
let transcriptPath
|
||||||
let summarizePath
|
let summarizePath
|
||||||
let llmpath
|
let llmpath
|
||||||
|
let speakers
|
||||||
|
|
||||||
describe("Unit Tests", function() {
|
describe("Unit Tests", function() {
|
||||||
|
|
||||||
@@ -34,7 +35,7 @@ describe("Unit Tests", function() {
|
|||||||
// console.log(resp);
|
// console.log(resp);
|
||||||
done()
|
done()
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
throw err;
|
done(err);
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
it('Extract .mp4 to .flac', function (done) {
|
it('Extract .mp4 to .flac', function (done) {
|
||||||
@@ -43,7 +44,7 @@ describe("Unit Tests", function() {
|
|||||||
// console.log(resp);
|
// console.log(resp);
|
||||||
done()
|
done()
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
throw err;
|
done(err);
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
it('Extracting to a nonexistant format', function (done) {
|
it('Extracting to a nonexistant format', function (done) {
|
||||||
@@ -86,7 +87,7 @@ describe("Unit Tests", function() {
|
|||||||
transcriptPath = resp
|
transcriptPath = resp
|
||||||
done()
|
done()
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
throw err
|
done(err)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -111,7 +112,7 @@ describe("Unit Tests", function() {
|
|||||||
mapFunctions.get("summarize-transcription").function(transcriptPath).then(resp => {
|
mapFunctions.get("summarize-transcription").function(transcriptPath).then(resp => {
|
||||||
done()
|
done()
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
throw err
|
done(err)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -128,7 +129,7 @@ describe("Unit Tests", function() {
|
|||||||
summarizePath = resp
|
summarizePath = resp
|
||||||
done()
|
done()
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
throw err
|
done(err)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -145,20 +146,92 @@ describe("Unit Tests", function() {
|
|||||||
this.slow(30000)
|
this.slow(30000)
|
||||||
this.timeout(120000)
|
this.timeout(120000)
|
||||||
|
|
||||||
// it("ChatGPT", function (done){
|
it("ChatGPT", function (done){
|
||||||
// mapFunctions.get("chatgpt").function({inputTranscriptPath: summarizePath, documentTypePath: "./storage/documentType/meetingReport.json", language: "en"}).then(resp => {
|
mapFunctions.get("llm-saia_openai_gpt").function({inputTranscriptPath: summarizePath, documentTypePath: "./storage/documentType/followup_report.txt", language: "en"}).then(resp => {
|
||||||
// done()
|
|
||||||
// }).catch(err => {
|
|
||||||
// throw err
|
|
||||||
// })
|
|
||||||
// })
|
|
||||||
|
|
||||||
it("Gemini", function (done){
|
|
||||||
mapFunctions.get("llm-gemini").function({inputTranscriptPath: summarizePath, documentTypePath: "./storage/documentType/meetingReport.json", language: "en"}).then(resp => {
|
|
||||||
llmpath = resp
|
llmpath = resp
|
||||||
done()
|
done()
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
throw err
|
done(err)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
it("Gemini", function (done){
|
||||||
|
mapFunctions.get("llm-gemini").function({inputTranscriptPath: summarizePath, documentTypePath: "./storage/documentType/followup_report.txt", language: "en"}).then(resp => {
|
||||||
|
done()
|
||||||
|
}).catch(err => {
|
||||||
|
if(err.includes("(503)")){done()} // Error 503 is gemini overload, so an Error that they can at any time throw at us which would crash the pipeline, so we just ignore it and we just imagine that the test passed
|
||||||
|
else{
|
||||||
|
console.log(err);
|
||||||
|
done(err)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
it("Qwen3", function (done){
|
||||||
|
mapFunctions.get("qwen3-235b-a22b").function({inputTranscriptPath: summarizePath, documentTypePath: "./storage/documentType/followup_report.txt", language: "en"}).then(resp => {
|
||||||
|
done()
|
||||||
|
}).catch(err => {
|
||||||
|
done(err)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
it("ChatGPT (Nonexistant Type File)", function (done){
|
||||||
|
mapFunctions.get("llm-saia_openai_gpt").function({inputTranscriptPath: summarizePath, documentTypePath: "a", language: "en"}).then(resp => {
|
||||||
|
done("Didnt crash")
|
||||||
|
}).catch(err => {
|
||||||
|
done()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
it("Gemini (Nonexistant Type File)", function (done){
|
||||||
|
mapFunctions.get("llm-gemini").function({inputTranscriptPath: summarizePath, documentTypePath: "a", language: "en"}).then(resp => {
|
||||||
|
done("Didnt crash")
|
||||||
|
}).catch(err => {
|
||||||
|
done()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
it("Qwen3 (Nonexistant Type File)", function (done){
|
||||||
|
mapFunctions.get("qwen3-235b-a22b").function({inputTranscriptPath: summarizePath, documentTypePath: "a", language: "en"}).then(resp => {
|
||||||
|
done("Didnt crash")
|
||||||
|
}).catch(err => {
|
||||||
|
done()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe("Audio Snippet", function() {
|
||||||
|
this.slow(1000)
|
||||||
|
this.timeout(5000)
|
||||||
|
|
||||||
|
// transcriptPath = "A:\\programing\\@projects\\video2document\\storage\\transcriptionSummaries\\testvideo-1765900665001.json"
|
||||||
|
// audiopath = "A:\\programing\\@projects\\video2document\\storage\\audio\\testvideo.mp3"
|
||||||
|
|
||||||
|
|
||||||
|
it("Audio Snipper Generator", function (done){
|
||||||
|
mapFunctions.get("extract-speaker-snippets").function({audioPath: audiopath, jsonPath: summarizePath }).then(resp => {
|
||||||
|
speakers = resp
|
||||||
|
done()
|
||||||
|
}).catch(err => {
|
||||||
|
done(err)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
it("Audio Snipper Generator (Nonexistant Transcript File)", function (done){
|
||||||
|
mapFunctions.get("extract-speaker-snippets").function({audioPath: audiopath, jsonPath: "a" }).then(resp => {
|
||||||
|
speakers = resp
|
||||||
|
done("Didnt crash")
|
||||||
|
}).catch(err => {
|
||||||
|
done()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
it("Audio Snipper Generator (Nonexistant Audio File)", function (done){
|
||||||
|
mapFunctions.get("extract-speaker-snippets").function({audioPath: "a", jsonPath: summarizePath }).then(resp => {
|
||||||
|
speakers = resp
|
||||||
|
done("Didnt crash")
|
||||||
|
}).catch(err => {
|
||||||
|
done()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user