feat: reprocess existing transcript via Ollama — modal button + POST /transcripts/{filename}/reprocess

This commit is contained in:
2026-04-01 14:27:15 +02:00
parent 3673e28e73
commit 33ae9dc1d8
3 changed files with 52 additions and 0 deletions
+18
View File
@@ -10,7 +10,9 @@ const modalTitle = document.getElementById('modal-title');
const modalBody = document.getElementById('modal-body');
const modalOpenBtn = document.getElementById('modal-open-btn');
const modalCloseBtn = document.getElementById('modal-close-btn');
const modalReprocessBtn = document.getElementById('modal-reprocess-btn');
let _modalPath = null;
let _modalFilename = null;
const STATUS_LABELS = {
idle: 'Bereit',
@@ -43,6 +45,7 @@ logoutBtn.addEventListener('click', () => {
function openModal(filename, path) {
_modalPath = path;
_modalFilename = filename;
modalTitle.textContent = filename.replace(/\.md$/, '').replace(/^\d{4}-\d{2}-\d{2}-\d{4}-/, '');
modalBody.innerHTML = '';
modal.classList.remove('hidden');
@@ -56,6 +59,7 @@ function openModal(filename, path) {
function closeModal() {
modal.classList.add('hidden');
_modalPath = null;
_modalFilename = null;
}
modalCloseBtn.addEventListener('click', closeModal);
@@ -65,6 +69,20 @@ modalOpenBtn.addEventListener('click', () => {
if (_modalPath) apiFetch('/open', { method: 'POST', body: JSON.stringify({ path: _modalPath }) });
});
modalReprocessBtn.addEventListener('click', async () => {
if (!_modalFilename) return;
modalReprocessBtn.disabled = true;
modalBody.textContent = 'Wird neu verarbeitet\u2026';
const instructions = instructionsEl.value;
const r = await apiFetch(`/transcripts/${encodeURIComponent(_modalFilename)}/reprocess`, {
method: 'POST',
body: JSON.stringify({ instructions }),
});
const md = await r.text();
modalBody.innerHTML = DOMPurify.sanitize(marked.parse(md));
modalReprocessBtn.disabled = false;
});
instructionsEl.addEventListener('input', async () => {
await apiFetch('/instructions', {
method: 'POST',