multi-stage Dockerfile + player recap styles
Dockerfile: split into whisperx-base and runtime stages so app-only changes skip the 10min pip install on rebuild. Example compose updated. Player recap: replace hardcoded 'story so far' prompt with selectable styles (story/diary/bullets/custom) via dropdown in Setup and Settings. Settings: add NAT20_ONBOARDING_COMPLETED env var; fix merge logic so env vars properly override defaults (not just empty DB values).
This commit is contained in:
@@ -26,7 +26,11 @@ def generate_notes(session_id: str):
|
||||
|
||||
def run(progress_cb):
|
||||
turns = load_turns(Path(session["transcript_path"]), speaker_map)
|
||||
dm_notes, player_recap = summarize_session(turns, settings, progress_cb=progress_cb)
|
||||
dm_notes, player_recap = summarize_session(
|
||||
turns, settings, progress_cb=progress_cb,
|
||||
player_recap_style=settings.get("player_recap_style"),
|
||||
player_recap_custom_prompt=settings.get("player_recap_custom_prompt"),
|
||||
)
|
||||
with db.tx() as conn:
|
||||
conn.execute(
|
||||
"INSERT INTO notes (session_id, dm_notes, player_recap, generated_at) VALUES (?, ?, ?, ?) "
|
||||
|
||||
@@ -13,6 +13,7 @@ router = APIRouter(prefix="/api/settings", tags=["settings"])
|
||||
|
||||
# Env var overrides — set these in docker-compose.yml to prefill the setup wizard
|
||||
_ENV_OVERRIDES = {
|
||||
"onboarding_completed": "NAT20_ONBOARDING_COMPLETED",
|
||||
"hf_token": "NAT20_HF_TOKEN",
|
||||
"whisper_model": "NAT20_WHISPER_MODEL",
|
||||
"whisper_compute_type": "NAT20_WHISPER_COMPUTE_TYPE",
|
||||
@@ -36,13 +37,16 @@ def _coerce(key: str, value: str):
|
||||
|
||||
|
||||
def _merge_with_env(raw: dict) -> dict:
|
||||
"""DB values win, env vars fill gaps, DEFAULT_SETTINGS fill remaining gaps."""
|
||||
merged = {**config.DEFAULT_SETTINGS, **raw}
|
||||
"""Priority: explicit user DB saves (non-default) > env vars > DEFAULT_SETTINGS."""
|
||||
merged = {**config.DEFAULT_SETTINGS}
|
||||
for key, env_name in _ENV_OVERRIDES.items():
|
||||
if not raw.get(key, "").strip():
|
||||
val = os.environ.get(env_name)
|
||||
if val is not None:
|
||||
merged[key] = val
|
||||
val = os.environ.get(env_name)
|
||||
if val is not None:
|
||||
merged[key] = val
|
||||
for key, val in raw.items():
|
||||
db_val = val.strip()
|
||||
if db_val and db_val != config.DEFAULT_SETTINGS.get(key, ""):
|
||||
merged[key] = db_val
|
||||
return merged
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user