Update 9 files

- /rag/config_models.py
- /rag/utils/config_loader.py
- /rag/auth.py
- /rag/rag_server.py
- /rag/rag_api.py
- /rag/rag_orchestrator.py
- /rag/__init__.py
- /bots/xmpp/client.py
- /bots/rag_client.py
This commit is contained in:
Markov Andrey
2026-06-30 14:27:34 +00:00
parent 068504c988
commit 59feffc190
9 changed files with 180 additions and 179 deletions

View File

@@ -101,12 +101,22 @@ def load_config(profile_dir: str) -> AppConfig:
if 'web_scraper' not in merged:
merged['web_scraper'] = {'max_pages': 5, 'max_depth': 1}
# Добавляем секцию auth, если её нет
if 'auth' not in merged:
merged['auth'] = {}
# Создаём экземпляр AppConfig
try:
config = AppConfig(**merged)
except Exception as e:
raise ValueError(f"Ошибка валидации конфигурации: {e}")
# Загружаем API-ключ для RAG-сервера
api_key_env = merged.get('auth', {}).get('api_key_env', 'RAG_API_KEY')
config._rag_api_key = os.getenv(api_key_env)
if not config._rag_api_key:
logger.warning(f"Переменная окружения {api_key_env} не задана. Аутентификация на RAG-сервере отключена (НЕ БЕЗОПАСНО!)")
# Загружаем промпты из файлов
prompts_dir = config.prompts_dir_path
if prompts_dir and prompts_dir.exists():