feat: reprocess existing transcript via Ollama — modal button + POST /transcripts/{filename}/reprocess
This commit is contained in:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user