mirror of
https://gitlab.rlp.net/proj-wise2526-video2document/video2document.git
synced 2026-06-15 18:01:52 +02:00
Fixed errors and added the loading of step 3 document types
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="de">
|
<html lang="de">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
@@ -21,7 +22,7 @@
|
|||||||
padding: 30px;
|
padding: 30px;
|
||||||
margin-top: 50px;
|
margin-top: 50px;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
box-shadow: 0 4px 20px rgba(0,0,0,0.1);
|
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
|
||||||
width: 90%;
|
width: 90%;
|
||||||
max-width: 600px;
|
max-width: 600px;
|
||||||
}
|
}
|
||||||
@@ -38,7 +39,9 @@
|
|||||||
color: #555;
|
color: #555;
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type="text"], textarea, select {
|
input[type="text"],
|
||||||
|
textarea,
|
||||||
|
select {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
@@ -59,7 +62,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.hidden {
|
.hidden {
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
button {
|
button {
|
||||||
@@ -81,6 +84,7 @@
|
|||||||
.buttons {
|
.buttons {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
.buttons button {
|
.buttons button {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
@@ -94,6 +98,7 @@
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h1>Manage document types</h1>
|
<h1>Manage document types</h1>
|
||||||
@@ -105,8 +110,8 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<div id="docNameWrapper">
|
<div id="docNameWrapper">
|
||||||
<label for="docName">Dokumentname:</label>
|
<label for="docName">Dokumentname:</label>
|
||||||
<input type="text" id="docName" placeholder="Gib hier den Dokumentnamen ein">
|
<input type="text" id="docName" placeholder="Gib hier den Dokumentnamen ein">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<label for="prompt">Dein Prompt:</label>
|
<label for="prompt">Dein Prompt:</label>
|
||||||
@@ -132,29 +137,23 @@
|
|||||||
const resultDiv = document.getElementById("result");
|
const resultDiv = document.getElementById("result");
|
||||||
const exampleText = "";
|
const exampleText = "";
|
||||||
|
|
||||||
|
|
||||||
// Zurück zur Haupt-GUI
|
|
||||||
goBackBtn.addEventListener("click", () => {
|
|
||||||
window.electronAPI.goBackToMain();
|
|
||||||
});
|
|
||||||
|
|
||||||
// dokumente speichern
|
// dokumente speichern
|
||||||
generateBtn.addEventListener("click", () => {
|
generateBtn.addEventListener("click", () => {
|
||||||
const name = docNameInput.value.trim();
|
const name = docNameInput.value.trim();
|
||||||
const content = promptInput.value.trim();
|
const content = promptInput.value.trim();
|
||||||
if (!name || !content) {
|
if (!name || !content) {
|
||||||
resultDiv.textContent = "Bitte Dokumentname und Prompt ausfüllen.";
|
resultDiv.textContent = "Bitte Dokumentname und Prompt ausfüllen.";
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
resultDiv.textContent = "";
|
resultDiv.textContent = "";
|
||||||
}, 3000);
|
}, 3000);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
window.api.saveTxtFile(name, content).then();
|
window.api.saveTxtFile(name, content).then();
|
||||||
resultDiv.textContent = "Dokument erfolgreich gespeichert!";
|
resultDiv.textContent = "Dokument erfolgreich gespeichert!";
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
resultDiv.textContent = "";
|
resultDiv.textContent = "";
|
||||||
}, 3000);
|
}, 3000);
|
||||||
reloadDocuments();
|
reloadDocuments();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -162,49 +161,47 @@
|
|||||||
const select = document.getElementById('existingDocs');
|
const select = document.getElementById('existingDocs');
|
||||||
|
|
||||||
window.api.getTxtFiles().then(files => {
|
window.api.getTxtFiles().then(files => {
|
||||||
reloadDocuments();
|
reloadDocuments();
|
||||||
});
|
});
|
||||||
|
|
||||||
//content anzeigen
|
//content anzeigen
|
||||||
const docNameWrapper = document.getElementById("docNameWrapper");
|
const docNameWrapper = document.getElementById("docNameWrapper");
|
||||||
|
|
||||||
existingDocs.addEventListener("change", async () => {
|
existingDocs.addEventListener("change", async () => {
|
||||||
const selected = existingDocs.value;
|
const selected = existingDocs.value;
|
||||||
|
|
||||||
if (selected === "newDoc") {
|
if (selected === "newDoc") {
|
||||||
docNameWrapper.classList.remove("hidden");
|
docNameWrapper.classList.remove("hidden");
|
||||||
docNameInput.value = "";
|
docNameInput.value = "";
|
||||||
promptInput.value = exampleText;
|
promptInput.value = exampleText;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
docNameWrapper.classList.add("hidden");
|
docNameWrapper.classList.add("hidden");
|
||||||
|
|
||||||
const content = await window.api.readTxtFile(selected);
|
const content = await window.api.readTxtFile(selected);
|
||||||
promptInput.value = content;
|
promptInput.value = content;
|
||||||
docNameInput.value = selected.replace(".txt", "");
|
docNameInput.value = selected.replace(".txt", "");
|
||||||
});
|
});
|
||||||
|
|
||||||
//reload drop down
|
//reload drop down
|
||||||
function reloadDocuments() {
|
function reloadDocuments() {
|
||||||
[...existingDocs.querySelectorAll('option:not([value="newDoc"])')]
|
[...existingDocs.querySelectorAll('option:not([value="newDoc"])')]
|
||||||
.forEach(o => o.remove());
|
.forEach(o => o.remove());
|
||||||
|
|
||||||
window.api.getTxtFiles().then(files => {
|
window.api.getTxtFiles().then(files => {
|
||||||
files.forEach(file => {
|
files.forEach(file => {
|
||||||
const option = document.createElement('option');
|
const option = document.createElement('option');
|
||||||
option.value = file;
|
option.value = file;
|
||||||
option.textContent = file
|
option.textContent = file
|
||||||
.replace('.txt', '') // Endung entfernen
|
.replace('.txt', '') // Endung entfernen
|
||||||
.replace(/_/g, ' ') // Leerzeichen ersetzen
|
.replace(/_/g, ' ') // Leerzeichen ersetzen
|
||||||
.replace(/\b\w/g, c => c.toUpperCase()) // ersten Buchstaben groß
|
.replace(/\b\w/g, c => c.toUpperCase()) // ersten Buchstaben groß
|
||||||
existingDocs.appendChild(option);
|
existingDocs.appendChild(option);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<script src="./renderer.js"></script>
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@@ -120,8 +120,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="checkbox-container">
|
<div class="checkbox-container">
|
||||||
<input type="checkbox" name="docFormat" id="docFormatCustom" value="custom">
|
<input type="checkbox" name="docFormat" id="docFormatCustom" value="custom">
|
||||||
<select name="ai_type" id="ai_type">
|
<select name="costumDocumentType" id="costumDocumentType">
|
||||||
<option>nichts</option>
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ window.addEventListener('load', async (e) => {
|
|||||||
console.log("Error in the window listener load in the renderer.js \n");
|
console.log("Error in the window listener load in the renderer.js \n");
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//Listener if the language of the displayed text's in the gui should be changed
|
//Listener if the language of the displayed text's in the gui should be changed
|
||||||
@@ -25,8 +24,8 @@ language_option.addEventListener('change', (e)=>{
|
|||||||
const select = document.getElementById('language_option');
|
const select = document.getElementById('language_option');
|
||||||
changeLanguage(select.value);
|
changeLanguage(select.value);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("Error in the language_option change listener in the renderer.js");
|
console.log("Error in the language_option change listener in the renderer.js");
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -419,3 +419,16 @@ function fileDownload() {
|
|||||||
console.error("Download failed:", error);
|
console.error("Download failed:", error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
window.api.getTxtFiles().then(files => {
|
||||||
|
files.forEach(file => {
|
||||||
|
const option = document.createElement('option');
|
||||||
|
option.value = file;
|
||||||
|
option.textContent = file
|
||||||
|
.replace('.txt', '') // Endung entfernen
|
||||||
|
.replace(/_/g, ' ') // Leerzeichen ersetzen
|
||||||
|
.replace(/\b\w/g, c => c.toUpperCase()) // ersten Buchstaben groß
|
||||||
|
costumDocumentType.appendChild(option);
|
||||||
|
});
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user