import sys import os from pathlib import Path sys.path.append(str(Path(__file__).resolve().parent.parent)) # --- Directories --- PROJECT_ROOT = Path(__file__).resolve().parent.parent.parent DATA_DIR = ( PROJECT_ROOT / "journal" / "data" ) # This will become the temporary decrypted data directory VAULT_DIR = ( PROJECT_ROOT / "journal" / "vault" ) # This will store the encrypted monthly vault files LOG_DIR = PROJECT_ROOT / "logs" PID_FILE = LOG_DIR / "nicegui_server.pid" SERVER_CONTROL_FILE = LOG_DIR / "server_control.action" DATABASE_FILENAME = "journal_cache.db" # --- Vault & Encryption --- SALT_SIZE = 16 KEY_SIZE = 32 # AES-256 AES_NONCE_SIZE = 12 AES_TAG_SIZE = 16 ITERATIONS = 600_000 MONTHLY_VAULT_FORMAT = "%Y-%m.vault" # e.g., 2025-07.vault # --- AI Configuration --- CLOUDAI_API_KEY = "" CLOUDAI_API_URL = "" LLAMA_CPP_URL = "http://127.0.0.1:8085/v1/completions" LLAMA_CPP_MODEL = "qwen/qwen3-4b" LLAMA_CPP_TIMEOUT = 6000 EMBEDDING_API_URL = "http://127.0.0.1:8086/v1/embeddings" EMBEDDING_MODEL_NAME = "text-embedding-nomic-embed-text-v2-moe" MODEL_CONTEXT_TOKENS = 131072 CHUNK_TOKEN_BUDGET = 120000 # --- Hardware Configuration --- # Set this to a specific index from `journal devices list` to force a microphone. # Setting this to `None` is recommended as it will use the system's default device. MICROPHONE_DEVICE_INDEX: int | None = None # --- Speech Recognition --- # "whisper" is local, private, and highly accurate (recommended). Downloads a model on first use. # "google" is online, accurate, but sends data to Google. # "sphinx" is offline, fast, but much less accurate. SPEECH_RECOGNITION_ENGINE: str = "whisper" WHISPER_MODEL_SIZE: str = "base" # Options: "tiny", "base", "small", "medium", "large" # NLP backend selection: # - auto: use spaCy when available, otherwise fallback heuristics. # - spacy: require spaCy backend and fail clearly if unavailable. # - fallback: always use lightweight fallback heuristics. NLP_BACKEND: str = os.getenv("JOURNAL_NLP_BACKEND", "auto").strip().lower() or "auto" if NLP_BACKEND not in {"auto", "spacy", "fallback"}: NLP_BACKEND = "auto" # --- Ensure directories exist --- DATA_DIR.mkdir(exist_ok=True) VAULT_DIR.mkdir(exist_ok=True) LOG_DIR.mkdir(exist_ok=True)