mirror of
https://gitlab.rlp.net/proj-wise2526-video2document/video2document.git
synced 2026-06-15 18:01:52 +02:00
Update language handling in document processing to support dynamic output languages
This commit is contained in:
@@ -253,7 +253,7 @@ electron.ipcMain.on("file_submit", async (event, args) => {
|
|||||||
.function(args.document.module, {
|
.function(args.document.module, {
|
||||||
inputTranscriptPath: transcriptpath,
|
inputTranscriptPath: transcriptpath,
|
||||||
documentTypePath: "./storage/documentType/" + templateFile,
|
documentTypePath: "./storage/documentType/" + templateFile,
|
||||||
language: "en",
|
language: args.document.outputLanguage
|
||||||
})
|
})
|
||||||
.then((resp) => {
|
.then((resp) => {
|
||||||
console.log(resp);
|
console.log(resp);
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
// const fs = require('fs');
|
// const fs = require('fs');
|
||||||
// const path = require('path');
|
// const path = require('path');
|
||||||
|
|
||||||
|
const e = require("express");
|
||||||
|
|
||||||
const outputDir = path.join(__dirname, "../../../storage/documents"); // path for output directory
|
const outputDir = path.join(__dirname, "../../../storage/documents"); // path for output directory
|
||||||
|
|
||||||
if (!fs.existsSync(outputDir)) {
|
if (!fs.existsSync(outputDir)) {
|
||||||
@@ -43,6 +45,14 @@ const module_exports = {
|
|||||||
const transcript = await fs.promises.readFile(transcriptPath, "utf-8"); //read transcript file from Path
|
const transcript = await fs.promises.readFile(transcriptPath, "utf-8"); //read transcript file from Path
|
||||||
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
|
||||||
|
|
||||||
|
if (language.toLowerCase() === "de") {
|
||||||
|
language = "German"
|
||||||
|
}else if (language.toLowerCase() === "in") {
|
||||||
|
language = "Indish"
|
||||||
|
} else {
|
||||||
|
language = "English"
|
||||||
|
}
|
||||||
|
|
||||||
// return
|
// return
|
||||||
// --- REST CALL ---
|
// --- REST CALL ---
|
||||||
|
|||||||
@@ -44,6 +44,14 @@ 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
|
||||||
|
|
||||||
|
if (language.toLowerCase() === "de") {
|
||||||
|
language = "German"
|
||||||
|
}else if (language.toLowerCase() === "in") {
|
||||||
|
language = "Indish"
|
||||||
|
} else {
|
||||||
|
language = "English"
|
||||||
|
}
|
||||||
|
|
||||||
// --- REST CALL ---
|
// --- REST CALL ---
|
||||||
const response = await fetch(`${GEMINI_URL}?key=${GEMINI_API_KEY}`, { //safe model response in variable
|
const response = await fetch(`${GEMINI_URL}?key=${GEMINI_API_KEY}`, { //safe model response in variable
|
||||||
method: "POST",
|
method: "POST",
|
||||||
|
|||||||
@@ -44,6 +44,14 @@ 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
|
||||||
|
|
||||||
|
if (language.toLowerCase() === "de") {
|
||||||
|
language = "German"
|
||||||
|
}else if (language.toLowerCase() === "in") {
|
||||||
|
language = "Indish"
|
||||||
|
} else {
|
||||||
|
language = "English"
|
||||||
|
}
|
||||||
|
|
||||||
// --- 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",
|
||||||
|
|||||||
Reference in New Issue
Block a user