#!/usr/bin/env python3 """ Скрипт валидации проекта AI-Colab после изменений """ import sys import json import os from pathlib import Path def validate_config(): """Проверка конфигурации""" config_path = Path("D:/Gemini/AI-colab/config/models_config.json") if not config_path.exists(): return ["Конфигурационный файл не найден"] with open(config_path, 'r', encoding='utf-8') as f: try: config = json.load(f) except Exception as e: return [f"Ошибка чтения JSON: {e}"] errors = [] # Проверка CEO модели active_models = config.get('active_models', {}) ceo_model = active_models.get('ceo') if not ceo_model: errors.append("CEO модель не найдена в active_models") else: expected_id = "Phi-3-mini-4k-instruct-GGUF/Phi-3-mini-4k-instruct-q4.gguf" if ceo_model.get('model_id') != expected_id: errors.append(f"CEO модель ID не совпадает. Ожидалось: {expected_id}, найдено: {ceo_model.get('model_id')}") if ceo_model.get('prompt_format') != "phi3": errors.append(f"Неверный prompt_format для CEO. Ожидалось: phi3, найдено: {ceo_model.get('prompt_format')}") return errors def validate_files(): """Проверка существования файлов""" base_dir = Path("D:/Gemini/AI-colab") required_files = [ base_dir / "config/models_config.json", base_dir / "prompts/ceo_system.txt", base_dir / "integrations/models/Phi-3-mini-4k-instruct-GGUF/Phi-3-mini-4k-instruct-q4.gguf", base_dir / "core/model_management.py" ] missing = [] for file in required_files: if not file.exists(): missing.append(str(file)) return missing def main(): """Основная функция валидации""" print("🔍 ВАЛИДАЦИЯ AI-COLAB") print("="*50) # Проверка файлов missing_files = validate_files() if missing_files: print("❌ Отсутствующие файлы:") for file in missing_files: print(f" - {file}") else: print("✅ Все критические файлы на месте") # Проверка конфигурации config_errors = validate_config() if config_errors: print("❌ Ошибки конфигурации:") for error in config_errors: print(f" - {error}") else: print("✅ Конфигурация корректна") print("="*50) if missing_files or config_errors: return 1 return 0 if __name__ == "__main__": sys.exit(main())