(summary) add optional satisfaction survey footer

Add a footer to transcription outputs linking to an external satisfaction
survey. The survey URL is built from TRANSCRIPTION_SATISFACTION_FORM_BASE_URL.
When TRANSCRIPTION_SATISFACTION_FORM_BASE_URL is unset or None, the
footer is omitted.
This commit is contained in:
leo
2026-06-03 14:37:30 +02:00
committed by lebaudantoine
parent 040df0e15a
commit 135b99aee7
11 changed files with 43 additions and 3 deletions
+1
View File
@@ -12,6 +12,7 @@ and this project adheres to
- ✨(frontend) allow disabling silent login via a URL parameter
- ✨(frontend) allow hiding the login button via a URL parameter
- ✨(summary) add optional satisfaction survey footer
### Changed
+3
View File
@@ -22,3 +22,6 @@ WEBHOOK_URL="https://configure-your-url.com"
POSTHOG_API_KEY="your-posthog-key"
POSTHOG_ENABLED="False"
# Transcription
TRANSCRIPTION_SATISFACTION_FORM_BASE_URL=
+10
View File
@@ -233,6 +233,7 @@ def format_transcript(
recording_datetime: str | None,
owner_timezone: str | None,
download_link: str | None,
form_link: str | None,
) -> tuple[str, str]:
"""Format a transcription into readable content with a title.
@@ -250,6 +251,7 @@ def format_transcript(
recording_datetime=recording_datetime,
owner_timezone=owner_timezone,
download_link=download_link,
form_link=form_link,
)
@@ -346,6 +348,13 @@ def process_audio_transcribe_summarize_v2(
task_id,
)
form_base_url = settings.transcription_satisfaction_form_base_url
form_link = (
f"{form_base_url}?room_id={room}"
if (form_base_url and metadata_filename is not None)
else None
)
# Format output
content, title = format_transcript(
transcription,
@@ -355,6 +364,7 @@ def process_audio_transcribe_summarize_v2(
recording_start_at,
owner_timezone,
download_link,
form_link,
)
submit_content(content, title, email, sub)
+1
View File
@@ -122,6 +122,7 @@ class Settings(BaseSettings):
# Summary related settings
is_summary_enabled: bool = True
transcription_satisfaction_form_base_url: Optional[str] = None
# Sentry
sentry_is_enabled: bool = False
+4
View File
@@ -25,6 +25,10 @@ Einige Punkte, die wir Ihnen empfehlen zu überprüfen:
download_header_template=(
"\n*[Laden Sie hier Ihre Aufnahme herunter (externer Link)]({download_link})*\n"
),
form_footer_template=(
"\n\n*[Teilen Sie uns mit, wie Ihnen diese Transkription gefallen hat "
"(externer Link)]({form_link})*\n"
),
hallucination_replacement_text="[Text konnte nicht transkribiert werden]",
document_default_title="Transkription",
document_title_template=(
+4
View File
@@ -25,6 +25,10 @@ A few things we recommend you check:
download_header_template=(
"\n*[Download your recording (external link)]({download_link})*\n"
),
form_footer_template=(
"\n\n*[Tell us what you thought of this transcription "
"(external link)]({form_link})*\n"
),
hallucination_replacement_text="[Unable to transcribe text]",
document_default_title="Transcription",
document_title_template=(
+3
View File
@@ -25,6 +25,9 @@ Quelques points que nous vous conseillons de vérifier :
download_header_template=(
"\n*[Télécharger votre enregistrement Audio]({download_link})*\n"
),
form_footer_template=(
"\n\n*[Donnez nous votre avis sur cette transcription]({form_link})*\n"
),
hallucination_replacement_text="[Texte impossible à transcrire]",
document_default_title="Transcription",
document_title_template=(
+4
View File
@@ -25,6 +25,10 @@ Een paar punten die wij u aanraden te controleren:
download_header_template=(
"\n*[Download hier je opname (externe link)]({download_link})*\n"
),
form_footer_template=(
"\n\n*[Laat ons weten wat je van deze transcriptie vond "
"(externe link)]({form_link})*\n"
),
hallucination_replacement_text="[Tekst kon niet worden getranscribeerd]",
document_default_title="Transcriptie",
document_title_template=(
@@ -10,6 +10,7 @@ class LocaleStrings:
# transcript_formatter.py
empty_transcription: str
download_header_template: str
form_footer_template: str
hallucination_replacement_text: str
document_default_title: str
document_title_template: str
@@ -38,13 +38,14 @@ class TranscriptFormatter:
return None
def format(
def format( # noqa: PLR0913
self,
transcription,
room: str | None = None,
recording_datetime: str | None = None,
owner_timezone: str | None = None,
download_link: str | None = None,
form_link: str | None = None,
) -> Tuple[str, str]:
"""Format transcription into the final document and its title."""
segments = self._get_segments(transcription)
@@ -55,6 +56,8 @@ class TranscriptFormatter:
content = self._format_speaker(segments)
content = self._remove_hallucinations(content)
content = self._add_header(content, download_link)
if form_link:
content = self._add_footer(content, form_link)
title = self._generate_title(room, recording_datetime, owner_timezone)
@@ -93,9 +96,14 @@ class TranscriptFormatter:
header = self._locale.download_header_template.format(
download_link=download_link
)
content = header + content
return header + content
return content
def _add_footer(self, content, form_link: str | None):
if not form_link:
return content
footer = self._locale.form_footer_template.format(form_link=form_link)
return content + footer
def _generate_title(
self,
+1
View File
@@ -27,6 +27,7 @@ class TestTasks:
"owner_timezone": "UTC",
"language": None,
"download_link": "https://example.com/file.mp4",
"form_link": "https://satisfaction.com?room_id=test",
},
)