Fix progress overlay, play-from-position, layout cutoff, speaker info
- Replace progress bar with task checklist showing pipeline steps (load model, transcribe, load diarization, identify speakers, merge) - Fix WaveformPlayer: track ready state, disable controls until loaded, play from current position instead of resetting to start - Fix workspace height calc to prevent bottom content cutoff - Show HF_TOKEN setup hint in SpeakerManager when no speakers detected - Add console logging for progress events to aid debugging Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,38 @@
|
||||
}
|
||||
|
||||
let { visible = false, percent = 0, stage = '', message = '' }: Props = $props();
|
||||
|
||||
// Map internal stage names to user-friendly labels
|
||||
const stageLabels: Record<string, string> = {
|
||||
'pipeline': 'Pipeline',
|
||||
'loading_model': 'Loading Model',
|
||||
'transcribing': 'Transcribing',
|
||||
'loading_diarization': 'Loading Diarization',
|
||||
'diarizing': 'Speaker Detection',
|
||||
'done': 'Complete',
|
||||
};
|
||||
|
||||
// Pipeline steps for the task list
|
||||
const pipelineSteps = [
|
||||
{ key: 'loading_model', label: 'Load transcription model' },
|
||||
{ key: 'transcribing', label: 'Transcribe audio' },
|
||||
{ key: 'loading_diarization', label: 'Load speaker detection model' },
|
||||
{ key: 'diarizing', label: 'Identify speakers' },
|
||||
{ key: 'merging', label: 'Merge results' },
|
||||
];
|
||||
|
||||
function getStepStatus(stepKey: string, currentStage: string): 'pending' | 'active' | 'done' {
|
||||
const stepOrder = pipelineSteps.map(s => s.key);
|
||||
const currentIdx = stepOrder.indexOf(currentStage);
|
||||
const stepIdx = stepOrder.indexOf(stepKey);
|
||||
|
||||
if (currentStage === 'done') return 'done';
|
||||
if (stepIdx < currentIdx) return 'done';
|
||||
if (stepIdx === currentIdx) return 'active';
|
||||
return 'pending';
|
||||
}
|
||||
|
||||
let displayStage = $derived(stageLabels[stage] || stage || 'Processing...');
|
||||
</script>
|
||||
|
||||
{#if visible}
|
||||
@@ -14,12 +46,28 @@
|
||||
<div class="progress-card">
|
||||
<div class="spinner-row">
|
||||
<div class="spinner"></div>
|
||||
<h3>{stage || 'Processing...'}</h3>
|
||||
<h3>{displayStage}</h3>
|
||||
</div>
|
||||
<div class="bar-track">
|
||||
<div class="bar-fill" style="width: {Math.max(percent, 2)}%"></div>
|
||||
|
||||
<div class="steps">
|
||||
{#each pipelineSteps as step}
|
||||
{@const status = getStepStatus(step.key, stage)}
|
||||
<div class="step" class:step-done={status === 'done'} class:step-active={status === 'active'}>
|
||||
<span class="step-icon">
|
||||
{#if status === 'done'}
|
||||
✓
|
||||
{:else if status === 'active'}
|
||||
⟳
|
||||
{:else}
|
||||
·
|
||||
{/if}
|
||||
</span>
|
||||
<span class="step-label">{step.label}</span>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
<p class="status-text">{percent}% — {message || 'Please wait...'}</p>
|
||||
|
||||
<p class="status-text">{message || 'Please wait...'}</p>
|
||||
<p class="hint-text">This may take several minutes for large files</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -39,7 +87,8 @@
|
||||
background: #16213e;
|
||||
padding: 2rem 2.5rem;
|
||||
border-radius: 12px;
|
||||
min-width: 420px;
|
||||
min-width: 380px;
|
||||
max-width: 440px;
|
||||
color: #e0e0e0;
|
||||
border: 1px solid #2a3a5e;
|
||||
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
|
||||
@@ -57,35 +106,52 @@
|
||||
border-top-color: #e94560;
|
||||
border-radius: 50%;
|
||||
animation: spin 0.8s linear infinite;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
@keyframes spin {
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
h3 {
|
||||
margin: 0;
|
||||
text-transform: capitalize;
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
.bar-track {
|
||||
height: 10px;
|
||||
background: #0f3460;
|
||||
border-radius: 5px;
|
||||
overflow: hidden;
|
||||
.steps {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.4rem;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
.bar-fill {
|
||||
height: 100%;
|
||||
background: linear-gradient(90deg, #e94560, #ff6b81);
|
||||
transition: width 0.3s;
|
||||
border-radius: 5px;
|
||||
.step {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
font-size: 0.85rem;
|
||||
color: #555;
|
||||
}
|
||||
.step-done {
|
||||
color: #4ecdc4;
|
||||
}
|
||||
.step-active {
|
||||
color: #e0e0e0;
|
||||
font-weight: 500;
|
||||
}
|
||||
.step-icon {
|
||||
width: 1.2rem;
|
||||
text-align: center;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.step-active .step-icon {
|
||||
animation: spin 1.5s linear infinite;
|
||||
display: inline-block;
|
||||
}
|
||||
.status-text {
|
||||
margin: 0.75rem 0 0;
|
||||
font-size: 0.9rem;
|
||||
font-size: 0.85rem;
|
||||
color: #b0b0b0;
|
||||
}
|
||||
.hint-text {
|
||||
margin: 0.5rem 0 0;
|
||||
font-size: 0.75rem;
|
||||
color: #666;
|
||||
color: #555;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -34,7 +34,11 @@
|
||||
<div class="speaker-manager">
|
||||
<h3>Speakers</h3>
|
||||
{#if $speakers.length === 0}
|
||||
<p class="empty-hint">No speakers detected yet</p>
|
||||
<p class="empty-hint">No speakers detected</p>
|
||||
<p class="setup-hint">
|
||||
Speaker detection requires a HuggingFace token.
|
||||
Set the <code>HF_TOKEN</code> environment variable and restart.
|
||||
</p>
|
||||
{:else}
|
||||
<ul class="speaker-list">
|
||||
{#each $speakers as speaker (speaker.id)}
|
||||
@@ -78,6 +82,19 @@
|
||||
.empty-hint {
|
||||
color: #666;
|
||||
font-size: 0.875rem;
|
||||
margin-bottom: 0.25rem;
|
||||
}
|
||||
.setup-hint {
|
||||
color: #555;
|
||||
font-size: 0.75rem;
|
||||
line-height: 1.4;
|
||||
}
|
||||
.setup-hint code {
|
||||
background: rgba(233, 69, 96, 0.15);
|
||||
color: #e94560;
|
||||
padding: 0.1rem 0.3rem;
|
||||
border-radius: 3px;
|
||||
font-size: 0.7rem;
|
||||
}
|
||||
.speaker-list {
|
||||
list-style: none;
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
let container: HTMLDivElement;
|
||||
let wavesurfer: WaveSurfer | null = $state(null);
|
||||
let isReady = $state(false);
|
||||
let currentTime = $state('0:00');
|
||||
let totalTime = $state('0:00');
|
||||
|
||||
@@ -39,6 +40,7 @@
|
||||
});
|
||||
|
||||
wavesurfer.on('ready', () => {
|
||||
isReady = true;
|
||||
const dur = wavesurfer!.getDuration();
|
||||
durationMs.set(Math.round(dur * 1000));
|
||||
totalTime = formatTime(dur);
|
||||
@@ -48,6 +50,10 @@
|
||||
wavesurfer.on('pause', () => isPlaying.set(false));
|
||||
wavesurfer.on('finish', () => isPlaying.set(false));
|
||||
|
||||
wavesurfer.on('loading', () => {
|
||||
isReady = false;
|
||||
});
|
||||
|
||||
if (audioUrl) {
|
||||
wavesurfer.load(audioUrl);
|
||||
}
|
||||
@@ -57,20 +63,21 @@
|
||||
wavesurfer?.destroy();
|
||||
});
|
||||
|
||||
/** Toggle play/pause. Exposed for keyboard shortcuts. */
|
||||
/** Toggle play/pause from current position. Exposed for keyboard shortcuts. */
|
||||
export function togglePlayPause() {
|
||||
wavesurfer?.playPause();
|
||||
if (!wavesurfer || !isReady) return;
|
||||
wavesurfer.playPause();
|
||||
}
|
||||
|
||||
function skipBack() {
|
||||
if (wavesurfer) {
|
||||
if (wavesurfer && isReady) {
|
||||
const time = Math.max(0, wavesurfer.getCurrentTime() - 5);
|
||||
wavesurfer.setTime(time);
|
||||
}
|
||||
}
|
||||
|
||||
function skipForward() {
|
||||
if (wavesurfer) {
|
||||
if (wavesurfer && isReady) {
|
||||
const time = Math.min(wavesurfer.getDuration(), wavesurfer.getCurrentTime() + 5);
|
||||
wavesurfer.setTime(time);
|
||||
}
|
||||
@@ -78,17 +85,20 @@
|
||||
|
||||
/** Seek to a specific time in milliseconds. Called from transcript click-to-seek. */
|
||||
export function seekTo(timeMs: number) {
|
||||
console.log('[voice-to-notes] seekTo called:', timeMs, 'ms, wavesurfer:', !!wavesurfer, 'duration:', wavesurfer?.getDuration());
|
||||
if (wavesurfer) {
|
||||
wavesurfer.setTime(timeMs / 1000);
|
||||
if (!wavesurfer.isPlaying()) {
|
||||
wavesurfer.play();
|
||||
}
|
||||
if (!wavesurfer || !isReady) {
|
||||
console.warn('[voice-to-notes] seekTo ignored — audio not ready yet');
|
||||
return;
|
||||
}
|
||||
const timeSec = timeMs / 1000;
|
||||
wavesurfer.setTime(timeSec);
|
||||
if (!wavesurfer.isPlaying()) {
|
||||
wavesurfer.play();
|
||||
}
|
||||
}
|
||||
|
||||
/** Load a new audio file. */
|
||||
export function loadAudio(url: string) {
|
||||
isReady = false;
|
||||
wavesurfer?.load(url);
|
||||
}
|
||||
</script>
|
||||
@@ -96,11 +106,17 @@
|
||||
<div class="waveform-player">
|
||||
<div class="waveform-container" bind:this={container}></div>
|
||||
<div class="controls">
|
||||
<button class="control-btn" onclick={skipBack} title="Back 5s">⏪</button>
|
||||
<button class="control-btn play-btn" onclick={togglePlayPause} title="Play/Pause">
|
||||
{#if $isPlaying}⏸{:else}▶{/if}
|
||||
<button class="control-btn" onclick={skipBack} title="Back 5s" disabled={!isReady}>⏪</button>
|
||||
<button class="control-btn play-btn" onclick={togglePlayPause} title="Play/Pause" disabled={!isReady}>
|
||||
{#if !isReady}
|
||||
⏳
|
||||
{:else if $isPlaying}
|
||||
⏸
|
||||
{:else}
|
||||
▶
|
||||
{/if}
|
||||
</button>
|
||||
<button class="control-btn" onclick={skipForward} title="Forward 5s">⏩</button>
|
||||
<button class="control-btn" onclick={skipForward} title="Forward 5s" disabled={!isReady}>⏩</button>
|
||||
<span class="time">{currentTime} / {totalTime}</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -130,9 +146,13 @@
|
||||
cursor: pointer;
|
||||
font-size: 1rem;
|
||||
}
|
||||
.control-btn:hover {
|
||||
.control-btn:hover:not(:disabled) {
|
||||
background: #1a4a7a;
|
||||
}
|
||||
.control-btn:disabled {
|
||||
opacity: 0.4;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
.play-btn {
|
||||
padding: 0.4rem 1rem;
|
||||
font-size: 1.2rem;
|
||||
|
||||
Reference in New Issue
Block a user