Files
doctate/server/templates/cases.html
T
Brummel 1e3cc9574c Refactor user config validation and add transcript display
Introduces a dedicated function `validate_and_index_users` to
encapsulate the logic for validating user configurations, checking for
duplicate slugs and API keys. This function returns a `Result` to handle
errors gracefully, and its usage in `load_users` is updated to panic
with a more informative error message.

Additionally, this commit modifies the web routing to fetch and display
audio transcripts. When scanning recordings, it now attempts to read a
corresponding `.transcript.txt` file. If found, the transcript content
is included in the `RecordingView` and rendered in the `cases.html`
template. If the transcript file is not found, a "Transcription pending"
message is displayed.

The `transcribe` function in `whisper.rs` is updated to explicitly set
the language to German (`language=de`), which can improve transcription
accuracy by skipping language detection. The `encode=false` query
parameter has been removed, as the service is designed to handle encoded
audio.

Finally, tests have been added for the new `validate_and_index_users`
function to ensure duplicate slugs and API keys are correctly rejected.
Integration tests in `web_test.rs` have been updated to verify the
rendering of transcripts and the pending status.
2026-04-13 17:08:21 +02:00

50 lines
1.6 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Doctate — Cases</title>
<style>
body { font-family: sans-serif; max-width: 900px; margin: 2em auto; padding: 0 1em; }
.case { border: 1px solid #ccc; margin: 1em 0; padding: 1em; border-radius: 4px; }
.case h2 { margin: 0 0 0.3em 0; font-size: 1.1em; }
.case small { color: #666; font-family: monospace; }
.status-open { border-left: 4px solid #4a90e2; }
.status-done { border-left: 4px solid #7ed321; }
.recording { margin: 0.5em 0; }
.recording-head { display: flex; align-items: center; gap: 1em; }
.recording-head span { font-family: monospace; font-size: 0.9em; min-width: 20em; }
.transcript { margin: 0.5em 0 0 1em; padding: 0.5em; background: #f6f6f6; border-radius: 4px; white-space: pre-wrap; font-family: serif; }
.pending { margin: 0.5em 0 0 1em; color: #888; font-style: italic; }
</style>
</head>
<body>
<h1>Cases</h1>
{% if cases.is_empty() %}
<p>No cases found.</p>
{% else %}
{% for case in cases %}
<div class="case status-{{ case.status }}">
<h2>{{ case.user_slug }} — {{ case.case_id_short }} ({{ case.status }})</h2>
<small>{{ case.case_id }}</small>
{% for rec in case.recordings %}
<div class="recording">
<div class="recording-head">
<span>{{ rec.filename }}</span>
<audio controls preload="none">
<source src="/web/audio/{{ case.user_slug }}/{{ case.case_id }}/{{ rec.filename }}" type="audio/mp4">
</audio>
</div>
{% match rec.transcript %}
{% when Some with (t) %}
<div class="transcript">{{ t }}</div>
{% when None %}
<div class="pending">Transcription pending…</div>
{% endmatch %}
</div>
{% endfor %}
</div>
{% endfor %}
{% endif %}
</body>
</html>