Skip to content

Speakr is a personal, self-hosted web application designed for transcribing audio recordings

Python

Add prompt_variables JSON column to recording for templated summary prompts

Murtaza Nasir370a8e297896
diff --git a/src/init_db.py b/src/init_db.py
index 435ea3dd..563a43a0 100644
--- a/src/init_db.py
+++ b/src/init_db.py
@@ -181,6 +181,10 @@ def initialize_database(app):
if add_column_if_not_exists(engine, 'recording', 'speaker_embeddings', 'JSON'):
app.logger.info("Added speaker_embeddings column to recording table")
+ # Per-recording prompt-template variables (e.g. {"agenda": "...", "attendees": "..."})
+ if add_column_if_not_exists(engine, 'recording', 'prompt_variables', 'JSON'):
+ app.logger.info("Added prompt_variables column to recording table")
+
# Add speaker voice profile embedding fields
if add_column_if_not_exists(engine, 'speaker', 'average_embedding', 'BLOB'):
app.logger.info("Added average_embedding column to speaker table")
diff --git a/src/models/recording.py b/src/models/recording.py
index ec3ece57..2c2574af 100644
--- a/src/models/recording.py
+++ b/src/models/recording.py
@@ -50,6 +50,10 @@ class Recording(db.Model):
# Speaker embeddings from diarization (JSON dict mapping speaker IDs to 256-dimensional vectors)
speaker_embeddings = db.Column(db.JSON, nullable=True)
+ # Per-recording prompt-template variables (e.g. {"agenda": "...", "attendees": "..."}).
+ # Substituted into {{name}} placeholders in the resolved summary prompt at summarisation time.
+ prompt_variables = db.Column(db.JSON, nullable=True)
+
# Folder relationship (one-to-many: a recording belongs to at most one folder)
folder_id = db.Column(db.Integer, db.ForeignKey('folder.id', ondelete='SET NULL'), nullable=True, index=True)