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, {
|
||||
inputTranscriptPath: transcriptpath,
|
||||
documentTypePath: "./storage/documentType/" + templateFile,
|
||||
language: "en",
|
||||
language: args.document.outputLanguage
|
||||
})
|
||||
.then((resp) => {
|
||||
console.log(resp);
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// const fs = require('fs');
|
||||
// const path = require('path');
|
||||
|
||||
const e = require("express");
|
||||
|
||||
const outputDir = path.join(__dirname, "../../../storage/documents"); // path for output directory
|
||||
|
||||
if (!fs.existsSync(outputDir)) {
|
||||
@@ -44,6 +46,14 @@ const module_exports = {
|
||||
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
|
||||
|
||||
if (language.toLowerCase() === "de") {
|
||||
language = "German"
|
||||
}else if (language.toLowerCase() === "in") {
|
||||
language = "Indish"
|
||||
} else {
|
||||
language = "English"
|
||||
}
|
||||
|
||||
// return
|
||||
// --- REST CALL ---
|
||||
const response = await fetch(SAIA_URL, { //safe model response in variable
|
||||
|
||||
@@ -44,6 +44,14 @@ const module_exports = {
|
||||
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
|
||||
|
||||
if (language.toLowerCase() === "de") {
|
||||
language = "German"
|
||||
}else if (language.toLowerCase() === "in") {
|
||||
language = "Indish"
|
||||
} else {
|
||||
language = "English"
|
||||
}
|
||||
|
||||
// --- REST CALL ---
|
||||
const response = await fetch(`${GEMINI_URL}?key=${GEMINI_API_KEY}`, { //safe model response in variable
|
||||
method: "POST",
|
||||
|
||||
@@ -44,6 +44,14 @@ const module_exports = {
|
||||
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
|
||||
|
||||
if (language.toLowerCase() === "de") {
|
||||
language = "German"
|
||||
}else if (language.toLowerCase() === "in") {
|
||||
language = "Indish"
|
||||
} else {
|
||||
language = "English"
|
||||
}
|
||||
|
||||
// --- REST CALL ---
|
||||
const response = await fetch(SAIA_URL, { //safe model response in variable
|
||||
method: "POST",
|
||||
|
||||
Reference in New Issue
Block a user