Initial commit: Nat20 Notes — TTRPG session transcription & summarization
This commit is contained in:
49
backend/app/config.py
Normal file
49
backend/app/config.py
Normal file
@@ -0,0 +1,49 @@
|
||||
"""
|
||||
App-wide configuration. Everything is either an environment variable (set once,
|
||||
at deploy time) or a row in the `settings` table (editable at runtime via the
|
||||
setup wizard / settings page) - never a hardcoded path or host.
|
||||
"""
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
# Deploy-time config (env vars) - where things live on disk inside the container.
|
||||
DATA_DIR = Path(os.environ.get("APP_DATA_DIR", "/data"))
|
||||
UPLOAD_DIR = DATA_DIR / "audio"
|
||||
AUDIO_DIR = DATA_DIR / "audio"
|
||||
TRANSCRIPT_DIR = DATA_DIR / "transcriptions"
|
||||
NOTES_DIR = DATA_DIR / "notes"
|
||||
DB_PATH = DATA_DIR / "app.db"
|
||||
|
||||
for d in (UPLOAD_DIR, AUDIO_DIR, TRANSCRIPT_DIR, NOTES_DIR):
|
||||
d.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
# Runtime-editable settings (stored in DB, these are just first-run defaults).
|
||||
# NOTE: this flat key/value schema is the single source of truth for settings -
|
||||
# it's what every consumer (pipeline/summarize.py, pipeline/transcribe.py,
|
||||
# routers/models.py, routers/diagnostics.py) actually reads. The settings
|
||||
# router and frontend must mirror these exact keys - a nested schema would
|
||||
# silently disconnect the Settings/Setup UI from the pipeline.
|
||||
DEFAULT_SETTINGS = {
|
||||
# Onboarding
|
||||
"onboarding_completed": "false",
|
||||
|
||||
# Transcription
|
||||
"whisper_model": "medium", # tiny|base|small|medium|large-v3 - user picks based on their hardware
|
||||
"whisper_compute_type": "int8",
|
||||
"hf_token": "", # required for diarization (pyannote gated models)
|
||||
|
||||
# Summarization backend: "ollama" (local) or "api" (hosted, OpenAI-compatible)
|
||||
"llm_mode": "ollama",
|
||||
"ollama_host": "http://localhost:11434",
|
||||
"ollama_model": "qwen2.5:7b",
|
||||
"api_base_url": "https://api.openai.com/v1",
|
||||
"api_key": "",
|
||||
"api_model": "gpt-4o-mini",
|
||||
|
||||
# Chunking for long transcripts (map-reduce summarization)
|
||||
"chunk_word_target": "2500",
|
||||
|
||||
# Optional world context injected into every summarization prompt
|
||||
"world_context": "",
|
||||
"world_context_path": "",
|
||||
}
|
||||
Reference in New Issue
Block a user