Files
Nat20-Notes/backend/app/config.py
KansaiGaijin ca13989ca0
All checks were successful
Build and Push / build (push) Successful in 12m10s
per-campaign settings, default campaign folders, custom prompt fix
2026-07-21 17:46:37 +12:00

67 lines
2.3 KiB
Python

"""
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 / "uploads"
AUDIO_DIR = DATA_DIR / "audio"
TRANSCRIPT_DIR = DATA_DIR / "transcriptions"
NOTES_DIR = DATA_DIR / "notes"
DB_PATH = DATA_DIR / "app.db"
CAMPAIGNS_DIR = DATA_DIR / "campaigns"
def campaign_dir(campaign_id: str) -> Path:
return CAMPAIGNS_DIR / campaign_id
def campaign_audio_dir(campaign_id: str) -> Path:
return campaign_dir(campaign_id) / "audio"
def campaign_transcript_dir(campaign_id: str) -> Path:
return campaign_dir(campaign_id) / "transcriptions"
def campaign_notes_dir(campaign_id: str) -> Path:
return campaign_dir(campaign_id) / "notes"
for d in (UPLOAD_DIR, AUDIO_DIR, TRANSCRIPT_DIR, NOTES_DIR):
d.mkdir(parents=True, exist_ok=True)
# Runtime-editable global settings (stored in the `settings` table).
# Only onboarding state lives here; everything else is per-campaign.
GLOBAL_SETTINGS = {
"onboarding_completed": "false",
}
# Per-campaign settings — seeded into campaign_settings on creation.
# Every layer (frontend, router, pipeline) reads these from the campaign.
CAMPAIGN_SETTINGS = {
# 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": "",
# Player recap style: "story" | "diary" | "bullets" | "custom"
"player_recap_style": "story",
"player_recap_custom_prompt": "",
}