File size: 4,217 Bytes
51b711f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
211e460
51b711f
211e460
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51b711f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# type: ignore
"""
AKIRA V21 ULTIMATE - Módulos Core
===============================
Arquitetura modular para IA conversacional com análise emocional BART.
Inclui aprendizado contínuo, escuta global e visão computacional.
"""

__version__ = "21.01.2025"
__author__ = "Isaac Quarenta"

# Exportações principais
from .config import (
    APP_NAME,
    APP_VERSION,
    DEBUG_MODE,
    NLP_CONFIG,
    get_system_prompt,
    PRIVILEGED_USERS,
    EmotionAnalyzer,
    MemoriaEmocional,
    get_emotion_analyzer,
    validate_config,
    # NLP Avançado exports - CORRIGIDO
    NLPAdvancedConfig,
    AdvancedNLP,
    get_advanced_nlp,
)

from .database import Database

from .contexto import Contexto, criar_contexto

# Import API com tratamento de erro
try:
    from .api import AkiraAPI, get_router
    API_AVAILABLE = True
except ImportError as e:
    try:
        from .api import AkiraAPI, get_blueprint as get_router
        API_AVAILABLE = True
    except ImportError as e2:
        print(f"Aviso: API não disponível - {e2}")
        API_AVAILABLE = False

# Aprendizado contínuo - é um módulo opcional
APRENDIZADO_CONTINUO_AVAILABLE = False
try:
    from .aprendizado_continuo import (
        AprendizadoContinuo,
        get_aprendizado_continuo,
        processar_conversa_global,
        ConversaGlobal,
        APIContextScore,
    )
    APRENDIZADO_CONTINUO_AVAILABLE = True
except ImportError as e:
    print(f"Aviso: Aprendizado Continuo nao disponivel - {e}")

# Visão Computacional - módulo opcional (requer OpenCV e Tesseract)
COMPUTER_VISION_AVAILABLE = False
try:
    from .computervision import (
        ComputerVision,
        get_computer_vision,
        VisionConfig,
        ImageFeature,
        analyze_image_from_base64,
        analyze_image_file,
    )
    COMPUTER_VISION_AVAILABLE = True
    print("✅ Visão Computacional DISPONÍVEL!")
except ImportError as e:
    print(f"⚠️  VISÃO DESABILITADA - Dependência faltando: {e}")
    print(f"   Para habilitar, instale: pip install opencv-python pytesseract pillow")
    # Cria stubs vazios
    ComputerVision = None
    get_computer_vision = None
    VisionConfig = None
    ImageFeature = None
    analyze_image_from_base64 = None
    analyze_image_file = None
except Exception as e:
    print(f"❌ ERRO ao carregar Visão: {type(e).__name__}: {e}")
    COMPUTER_VISION_AVAILABLE = False
    ComputerVision = None
    get_computer_vision = None
    VisionConfig = None
    ImageFeature = None
    analyze_image_from_base64 = None
    analyze_image_file = None

# ThinkingEngine - Chain-of-Thought pré-processamento (requer sentence-transformers)
THINKING_ENGINE_AVAILABLE = False
try:
    from .thinking_engine import ThinkingEngine, get_thinking_engine
    THINKING_ENGINE_AVAILABLE = True
except ImportError as e:
    print(f"Aviso: ThinkingEngine não disponível - {e}")

__all__ = [
    # Config
    "APP_NAME",
    "APP_VERSION",
    "DEBUG_MODE",
    "NLP_CONFIG",
    "get_system_prompt",
    "PRIVILEGED_USERS",
    "EmotionAnalyzer",
    "MemoriaEmocional",
    "get_emotion_analyzer",
    "validate_config",
    # NLP Avançado
    "NLPAdvancedConfig",
    "AdvancedNLP",
    "get_advanced_nlp",
    # Database
    "Database",
    # Contexto
    "Contexto",
    "criar_contexto",
    # API
    "AkiraAPI",
    "get_blueprint",
    "API_AVAILABLE",
    # Aprendizado Continuo
    "APRENDIZADO_CONTINUO_AVAILABLE",
    # Visão Computacional
    "COMPUTER_VISION_AVAILABLE",
]

# 🔧 SENDER ATTRIBUTION FIX já aplicado diretamente em api.py (validate_sender_name)
# NOTA: O auto-patcher foi removido porque já injetou o código. Mantido manualmente agora.
# Adiciona Aprendizado Continuo se disponível
if APRENDIZADO_CONTINUO_AVAILABLE:
    __all__.extend([
        "AprendizadoContinuo",
        "get_aprendizado_continuo",
        "processar_conversa_global",
        "ConversaGlobal",
        "APIContextScore",
    ])

# Adiciona Visão Computacional se disponível
if COMPUTER_VISION_AVAILABLE:
    __all__.extend([
        "ComputerVision",
        "get_computer_vision",
        "VisionConfig",
        "ImageFeature",
        "analyze_image_from_base64",
        "analyze_image_file",
    ])