Commit Graph

3 Commits

Author SHA1 Message Date
5ac1f7fa8c cleanup: remove dead code + deduplicate GPU state reads
Dead code removed:
- globals.py: GUILD_SETTINGS (empty dict, zero consumers)
- config.py: unused 'import os'
- config_manager.py: unused 'import os' and 'Union'
- server_manager.py: duplicate 'from datetime import datetime, timedelta'

GPU deduplication:
- get_current_gpu_url() now delegates to config_manager.get_gpu()
- get_gpu_status() endpoint now delegates to config_manager.get_gpu()
- Both previously re-read memory/gpu_state.json directly
2026-04-09 20:34:17 +03:00
0831f721e1 cleanup: remove dead backward-compat globals from config.py
Removed the Config Manager Integration block and all 19 backward-compat
variable re-exports (LLAMA_URL, CHESHIRE_CAT_URL, LANGUAGE_MODE, etc.)
from config.py. These were dead code because:

1. Circular import: config.py tried to import config_manager at module
   level, but config_manager.py imports from config.py first, so
   HAS_CONFIG_MANAGER was always False and _get_config_value() was a
   no-op that always returned the static value.

2. Frozen snapshots: Even if the circular import worked, the values were
   assigned to module-level names at import time and never updated. Other
   modules importing 'from config import LLAMA_URL' would get a stale
   snapshot, not a live value.

3. Nothing imports them: The entire codebase uses globals.py for mutable
   runtime state, not these config.py copies. Only ERROR_WEBHOOK_URL was
   imported (by error_handler.py), so it is kept as a simple re-export
   from SECRETS.

Also cleaned up unused imports: Any, field_validator.

Japanese mode is NOT affected — LANGUAGE_MODE and JAPANESE_TEXT_MODEL live
in globals.py and are untouched.
2026-04-08 14:40:16 +03:00
8d09a8a52f Implement comprehensive config system and clean up codebase
Major changes:
- Add Pydantic-based configuration system (bot/config.py, bot/config_manager.py)
- Add config.yaml with all service URLs, models, and feature flags
- Fix config.yaml path resolution in Docker (check /app/config.yaml first)
- Remove Fish Audio API integration (tested feature that didn't work)
- Remove hardcoded ERROR_WEBHOOK_URL, import from config instead
- Add missing Pydantic models (LogConfigUpdateRequest, LogFilterUpdateRequest)
- Enable Cheshire Cat memory system by default (USE_CHESHIRE_CAT=true)
- Add .env.example template with all required environment variables
- Add setup.sh script for user-friendly initialization
- Update docker-compose.yml with proper env file mounting
- Update .gitignore for config files and temporary files

Config system features:
- Static configuration from config.yaml
- Runtime overrides from config_runtime.yaml
- Environment variables for secrets (.env)
- Web UI integration via config_manager
- Graceful fallback to defaults

Secrets handling:
- Move ERROR_WEBHOOK_URL from hardcoded to .env
- Add .env.example with all placeholder values
- Document all required secrets
- Fish API key and voice ID removed from .env

Documentation:
- CONFIG_README.md - Configuration system guide
- CONFIG_SYSTEM_COMPLETE.md - Implementation summary
- FISH_API_REMOVAL_COMPLETE.md - Removal record
- SECRETS_CONFIGURED.md - Secrets setup record
- BOT_STARTUP_FIX.md - Pydantic model fixes
- MIGRATION_CHECKLIST.md - Setup checklist
- WEB_UI_INTEGRATION_COMPLETE.md - Web UI config guide
- Updated readmes/README.md with new features
2026-02-15 19:51:00 +02:00