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',
|
||||
|
||||
@@ -200,6 +200,11 @@
|
||||
<div class="modal-header">
|
||||
<span id="modal-title" class="modal-title"></span>
|
||||
<div class="modal-actions">
|
||||
<button id="modal-reprocess-btn" class="modal-btn" title="Neu verarbeiten">
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor">
|
||||
<path d="M17.65 6.35A7.96 7.96 0 0 0 12 4a8 8 0 1 0 8 8h-2a6 6 0 1 1-1.76-4.24l-2.24 2.24H20V4l-2.35 2.35z"/>
|
||||
</svg>
|
||||
</button>
|
||||
<button id="modal-open-btn" class="modal-btn" title="Im Editor öffnen">
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor">
|
||||
<path d="M14 3h7v7h-2V6.41l-9.29 9.3-1.42-1.42L17.59 5H14V3zm-1 2H5a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8h-2v8H5V7h8V5z"/>
|
||||
|
||||
Reference in New Issue
Block a user