Spaces:
Running
“Gebruik dit aanvullende gedeelte als uitbreidingsspecificatie voor de functionaliteit.”
Browse filesAanvullende eisen:
12. Automatisch afsluiten:
- Na een succesvolle conversie en validatie sluit het programma automatisch binnen 3 seconden.
- Toon kort een statusmelding ("Conversie voltooid — programma sluit nu automatisch.") voordat het venster sluit.
- Als er een fout optreedt, blijft het programma open en toont het een foutmelding met loglink.
13. Instellingen voor opslaan:
- Voeg een tab of sectie toe aan de GUI genaamd “Opslaginstellingen”.
- Gebruiker kan aanpassen:
• Standaard uitvoermap (output directory).
• Optie om elke conversie in een nieuwe submap te plaatsen (met tijdstempel).
• Of bestaande bestanden overschreven mogen worden.
• Of instellingen bij afsluiten opgeslagen moeten worden.
- Sla deze voorkeuren lokaal op in een JSON-bestand: `settings.json`.
- Laad deze instellingen automatisch bij het opstarten van de app.
- Als `settings.json` ontbreekt of corrupt is, genereer standaardwaarden.
- Toon huidige instellingen samenvatting in een collapsible panel onderaan het hoofdvenster.
14. Logging & afsluitgedrag:
- Schrijf elke conversie-log naar `logs/last_run.log`.
- Als het programma automatisch sluit, zorg dat het logbestand blijft bestaan in de outputmap of `logs/`.
- Voeg een instelling toe “Automatisch afsluiten na conversie (ja/nee)” in het instellingenmenu.
- index.html +58 -30
|
@@ -278,6 +278,10 @@
|
|
| 278 |
// Settings management
|
| 279 |
function loadSettings() {
|
| 280 |
try {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 281 |
const settings = JSON.parse(localStorage.getItem('ama_settings')) || {
|
| 282 |
outputDir: '',
|
| 283 |
createSubdir: true,
|
|
@@ -285,8 +289,7 @@
|
|
| 285 |
saveSettings: true,
|
| 286 |
autoClose: true
|
| 287 |
};
|
| 288 |
-
|
| 289 |
-
document.getElementById('outputDir').value = settings.outputDir;
|
| 290 |
document.getElementById('createSubdir').checked = settings.createSubdir;
|
| 291 |
document.getElementById('overwriteFiles').checked = settings.overwriteFiles;
|
| 292 |
document.getElementById('saveSettings').checked = settings.saveSettings;
|
|
@@ -305,7 +308,6 @@
|
|
| 305 |
};
|
| 306 |
}
|
| 307 |
}
|
| 308 |
-
|
| 309 |
function saveSettings() {
|
| 310 |
const settings = {
|
| 311 |
outputDir: document.getElementById('outputDir').value,
|
|
@@ -316,11 +318,29 @@
|
|
| 316 |
};
|
| 317 |
|
| 318 |
localStorage.setItem('ama_settings', JSON.stringify(settings));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 319 |
updateSettingsSummary();
|
| 320 |
return settings;
|
| 321 |
}
|
| 322 |
-
|
| 323 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 324 |
const settings = JSON.parse(localStorage.getItem('ama_settings')) || {};
|
| 325 |
document.getElementById('currentOutputDir').textContent = settings.outputDir || 'Not set';
|
| 326 |
document.getElementById('currentSubdir').textContent = settings.createSubdir ? 'Yes' : 'No';
|
|
@@ -517,21 +537,24 @@ VANTA.WAVES({
|
|
| 517 |
progressLog.innerHTML = '<div>> Initializing model conversion...</div>';
|
| 518 |
hideModalBtn.disabled = true;
|
| 519 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 520 |
|
| 521 |
-
|
| 522 |
-
|
| 523 |
-
|
| 524 |
-
|
| 525 |
-
|
| 526 |
-
{percent: 40, message: "> Exporting text encoder to ONNX format..."},
|
| 527 |
-
{percent: 55, message: "> Exporting UNet to ONNX format..."},
|
| 528 |
-
{percent: 70, message: "> Exporting VAE to ONNX format..."},
|
| 529 |
-
{percent: 85, message: "> Running Olive optimization passes..."},
|
| 530 |
-
{percent: 95, message: "> Performing smoke test validation..."},
|
| 531 |
-
{percent: 100, message: "> Conversion complete! Output saved to models/exported_model"}
|
| 532 |
-
];
|
| 533 |
-
|
| 534 |
-
const interval = setInterval(() => {
|
| 535 |
if (progress >= steps.length) {
|
| 536 |
clearInterval(interval);
|
| 537 |
hideModalBtn.disabled = false;
|
|
@@ -545,32 +568,37 @@ VANTA.WAVES({
|
|
| 545 |
logEntry.textContent = step.message;
|
| 546 |
progressLog.appendChild(logEntry);
|
| 547 |
progressLog.scrollTop = progressLog.scrollHeight;
|
| 548 |
-
|
| 549 |
-
// If this is the last step and auto-close is enabled
|
| 550 |
if (progress === steps.length - 1) {
|
| 551 |
const settings = JSON.parse(localStorage.getItem('ama_settings')) || {};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 552 |
if (settings.autoClose) {
|
| 553 |
const completeMsg = document.createElement('div');
|
| 554 |
completeMsg.className = 'text-green-400';
|
| 555 |
-
completeMsg.textContent = '>
|
| 556 |
progressLog.appendChild(completeMsg);
|
| 557 |
|
| 558 |
setTimeout(() => {
|
| 559 |
-
// In a real app, this would trigger the window close
|
| 560 |
-
// For demo purposes, we'll just hide the modal
|
| 561 |
progressModal.classList.add('hidden');
|
| 562 |
resetProgress();
|
| 563 |
-
|
| 564 |
-
//
|
| 565 |
-
const logContent = Array.from(progressLog.children).map(el => el.textContent).join('\n');
|
| 566 |
-
console.log('Log content saved to last_run.log:\n', logContent);
|
| 567 |
}, 3000);
|
| 568 |
} else {
|
| 569 |
hideModalBtn.disabled = false;
|
| 570 |
}
|
| 571 |
}
|
| 572 |
-
|
| 573 |
-
progress++;
|
| 574 |
}, 1500);
|
| 575 |
}
|
| 576 |
});
|
|
|
|
| 278 |
// Settings management
|
| 279 |
function loadSettings() {
|
| 280 |
try {
|
| 281 |
+
// In a real app, this would load from settings.json file
|
| 282 |
+
// const settingsData = fs.readFileSync(path.join(app.getPath('userData'), 'settings.json'), 'utf8');
|
| 283 |
+
// const settings = JSON.parse(settingsData);
|
| 284 |
+
|
| 285 |
const settings = JSON.parse(localStorage.getItem('ama_settings')) || {
|
| 286 |
outputDir: '',
|
| 287 |
createSubdir: true,
|
|
|
|
| 289 |
saveSettings: true,
|
| 290 |
autoClose: true
|
| 291 |
};
|
| 292 |
+
document.getElementById('outputDir').value = settings.outputDir;
|
|
|
|
| 293 |
document.getElementById('createSubdir').checked = settings.createSubdir;
|
| 294 |
document.getElementById('overwriteFiles').checked = settings.overwriteFiles;
|
| 295 |
document.getElementById('saveSettings').checked = settings.saveSettings;
|
|
|
|
| 308 |
};
|
| 309 |
}
|
| 310 |
}
|
|
|
|
| 311 |
function saveSettings() {
|
| 312 |
const settings = {
|
| 313 |
outputDir: document.getElementById('outputDir').value,
|
|
|
|
| 318 |
};
|
| 319 |
|
| 320 |
localStorage.setItem('ama_settings', JSON.stringify(settings));
|
| 321 |
+
|
| 322 |
+
// In a real app, this would save to settings.json file
|
| 323 |
+
// const settingsJSON = JSON.stringify(settings, null, 2);
|
| 324 |
+
// fs.writeFileSync(path.join(app.getPath('userData'), 'settings.json'), settingsJSON);
|
| 325 |
+
|
| 326 |
updateSettingsSummary();
|
| 327 |
return settings;
|
| 328 |
}
|
| 329 |
+
|
| 330 |
+
// Error handling for settings loading
|
| 331 |
+
function handleSettingsError(error) {
|
| 332 |
+
console.error('Settings error:', error);
|
| 333 |
+
const defaultSettings = {
|
| 334 |
+
outputDir: '',
|
| 335 |
+
createSubdir: true,
|
| 336 |
+
overwriteFiles: false,
|
| 337 |
+
saveSettings: true,
|
| 338 |
+
autoClose: true
|
| 339 |
+
};
|
| 340 |
+
localStorage.setItem('ama_settings', JSON.stringify(defaultSettings));
|
| 341 |
+
return defaultSettings;
|
| 342 |
+
}
|
| 343 |
+
function updateSettingsSummary() {
|
| 344 |
const settings = JSON.parse(localStorage.getItem('ama_settings')) || {};
|
| 345 |
document.getElementById('currentOutputDir').textContent = settings.outputDir || 'Not set';
|
| 346 |
document.getElementById('currentSubdir').textContent = settings.createSubdir ? 'Yes' : 'No';
|
|
|
|
| 537 |
progressLog.innerHTML = '<div>> Initializing model conversion...</div>';
|
| 538 |
hideModalBtn.disabled = true;
|
| 539 |
}
|
| 540 |
+
function simulateConversion() {
|
| 541 |
+
let progress = 0;
|
| 542 |
+
const steps = [
|
| 543 |
+
{percent: 10, message: "> Detecting model type and components..."},
|
| 544 |
+
{percent: 25, message: "> Preparing model for ONNX export..."},
|
| 545 |
+
{percent: 40, message: "> Exporting text encoder to ONNX format..."},
|
| 546 |
+
{percent: 55, message: "> Exporting UNet to ONNX format..."},
|
| 547 |
+
{percent: 70, message: "> Exporting VAE to ONNX format..."},
|
| 548 |
+
{percent: 85, message: "> Running Olive optimization passes..."},
|
| 549 |
+
{percent: 95, message: "> Performing smoke test validation..."},
|
| 550 |
+
{percent: 100, message: "> Conversion complete! Output saved to models/exported_model"}
|
| 551 |
+
];
|
| 552 |
|
| 553 |
+
// Create logs directory if it doesn't exist
|
| 554 |
+
if (!localStorage.getItem('ama_logs')) {
|
| 555 |
+
localStorage.setItem('ama_logs', JSON.stringify([]));
|
| 556 |
+
}
|
| 557 |
+
const interval = setInterval(() => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 558 |
if (progress >= steps.length) {
|
| 559 |
clearInterval(interval);
|
| 560 |
hideModalBtn.disabled = false;
|
|
|
|
| 568 |
logEntry.textContent = step.message;
|
| 569 |
progressLog.appendChild(logEntry);
|
| 570 |
progressLog.scrollTop = progressLog.scrollHeight;
|
| 571 |
+
// If this is the last step
|
|
|
|
| 572 |
if (progress === steps.length - 1) {
|
| 573 |
const settings = JSON.parse(localStorage.getItem('ama_settings')) || {};
|
| 574 |
+
|
| 575 |
+
// Save log
|
| 576 |
+
const logContent = Array.from(progressLog.children).map(el => el.textContent).join('\n');
|
| 577 |
+
const logs = JSON.parse(localStorage.getItem('ama_logs') || '[]');
|
| 578 |
+
logs.push({
|
| 579 |
+
timestamp: new Date().toISOString(),
|
| 580 |
+
content: logContent
|
| 581 |
+
});
|
| 582 |
+
localStorage.setItem('ama_logs', JSON.stringify(logs));
|
| 583 |
+
console.log('Log content saved:\n', logContent);
|
| 584 |
+
|
| 585 |
if (settings.autoClose) {
|
| 586 |
const completeMsg = document.createElement('div');
|
| 587 |
completeMsg.className = 'text-green-400';
|
| 588 |
+
completeMsg.textContent = '> Conversie voltooid — programma sluit nu automatisch.';
|
| 589 |
progressLog.appendChild(completeMsg);
|
| 590 |
|
| 591 |
setTimeout(() => {
|
|
|
|
|
|
|
| 592 |
progressModal.classList.add('hidden');
|
| 593 |
resetProgress();
|
| 594 |
+
// In a real app, this would close the window
|
| 595 |
+
// window.close();
|
|
|
|
|
|
|
| 596 |
}, 3000);
|
| 597 |
} else {
|
| 598 |
hideModalBtn.disabled = false;
|
| 599 |
}
|
| 600 |
}
|
| 601 |
+
progress++;
|
|
|
|
| 602 |
}, 1500);
|
| 603 |
}
|
| 604 |
});
|