-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
98 lines (84 loc) · 3.2 KB
/
setup.py
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
import sys
from pathlib import Path
import sqlite3
import logging
logging.disable(logging.WARNING)
def create_directories():
"""Create necessary directories for EVA"""
app_dir = Path(__file__).resolve() / 'app' / 'data'
# Create data directories
directories = [
app_dir / 'database',
app_dir / 'voids',
app_dir / 'pids',
]
try:
for directory in directories:
directory.mkdir(parents=True, exist_ok=True)
except Exception as e:
logging.error(f"Directory setup error: {e}")
sys.exit(1)
def setup_database():
"""Initialize the SQLite database with required tables"""
try:
db_path = Path(__file__).resolve() / 'app' / 'data' / 'database' / 'eva.db'
with sqlite3.connect(db_path) as conn:
cursor = conn.cursor()
# Create memory log table
cursor.execute('''
CREATE TABLE IF NOT EXISTS memorylog (
id INTEGER PRIMARY KEY AUTOINCREMENT,
time TEXT NOT NULL,
user_name TEXT,
user_message TEXT,
eva_message TEXT,
observation TEXT,
analysis TEXT,
strategy TEXT,
premeditation TEXT,
action TEXT
)
''')
# Create voice ID table
cursor.execute('''
CREATE TABLE IF NOT EXISTS ids (
id INTEGER PRIMARY KEY AUTOINCREMENT,
void TEXT,
pid TEXT,
user_name TEXT NOT NULL
)
''')
conn.commit()
logging.info("Database tables created successfully")
except sqlite3.Error as e:
logging.error(f"Database setup error: {e}")
sys.exit(1)
def test_modules():
"""Test importing the modules"""
try:
from app.core import eva
from app.tools import ToolManager
from app.utils.agent import ChatAgent
from app.utils.extension import Window, MidjourneyServer
from app.utils.memory import Memory
from app.utils.stt import PCListener
from app.utils.stt.model_fasterwhisper import FWTranscriber
from app.utils.stt.model_whisper import WhisperTranscriber
from app.utils.stt.model_groq import GroqTranscriber
from app.utils.tts import Speaker
from app.utils.tts.model_elevenlabs import ElevenLabsSpeaker
from app.utils.tts.model_coqui import CoquiSpeaker
from app.utils.tts.model_openai import OpenAISpeaker
from app.utils.vision import Watcher
from app.utils.vision.model_groq import GroqVision
from app.utils.vision.model_openai import OpenAIVision
from app.utils.vision.model_ollama import OllamaVision
except ImportError as e:
logging.error(f"MODULES NOT INSTALLED! {e}")
sys.exit(1)
if __name__ == "__main__":
logging.info("Starting EVA setup...")
create_directories()
setup_database()
test_modules()
logging.info("EVA setup completed successfully")