Compare commits

...

2 Commits

Author SHA1 Message Date
4b5be3bf97 fix: align config.yaml structure with Pydantic AppConfig schema
config.yaml nested cheshire_cat and face_detector under the 'services' key,
and llama URLs under 'services.llama'. But AppConfig expects:
- services -> {url, amd_url} (llama endpoints directly)
- cheshire_cat -> top-level key
- face_detector -> top-level key

Because Pydantic silently ignores extra fields, ServicesConfig received
{llama: {...}, cheshire_cat: {...}, face_detector: {...}} and none matched
its 'url'/'amd_url' fields, so ALL service config from YAML was silently
ignored and Pydantic defaults were always used instead.

Flattened services to contain url/amd_url directly, and moved cheshire_cat
and face_detector to top-level keys matching the AppConfig model. Verified
both AppConfig(**yaml_data) and config_manager dot-path traversal work.
2026-04-08 14:14:56 +03:00
742b7b6b64 fix: persist config_runtime.yaml inside volume-mounted memory dir
config_runtime.yaml was written to the container root (/) because the path
resolved via Path(__file__).parent.parent from /app/config_manager.py = /.
This location is not volume-mounted, so all runtime config changes (language,
debug flags, Cheshire Cat toggle, mood, GPU preference) were lost on every
container restart.

Moved runtime_config_path to memory/config_runtime.yaml, which lives inside
the volume-mounted ./bot/memory:/app/memory directory and persists across
restarts. Also reordered __init__ so memory_dir is initialized before
runtime_config_path depends on it.
2026-04-08 14:14:31 +03:00
2 changed files with 14 additions and 12 deletions

View File

@@ -35,12 +35,15 @@ class ConfigManager:
def __init__(self, config_path: Optional[str] = None):
"""Initialize configuration manager."""
self.config_path = Path(config_path) if config_path else Path(__file__).parent.parent / "config.yaml"
self.runtime_config_path = Path(__file__).parent.parent / "config_runtime.yaml"
# Memory directory for server configs and state
# This directory is volume-mounted in Docker (./bot/memory:/app/memory)
self.memory_dir = Path(__file__).parent / "memory"
self.memory_dir.mkdir(exist_ok=True)
# Runtime config must live inside memory_dir so it persists across container restarts
self.runtime_config_path = self.memory_dir / "config_runtime.yaml"
# Load configurations
self.static_config: Dict = self._load_static_config()
self.runtime_config: Dict = self._load_runtime_config()

View File

@@ -6,7 +6,6 @@
# Service Endpoints
services:
llama:
url: http://llama-swap:8080
amd_url: http://llama-swap-amd:8080