File size: 2,891 Bytes
0b2210a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/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())