-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_dev.py
More file actions
executable file
·90 lines (74 loc) · 2.92 KB
/
setup_dev.py
File metadata and controls
executable file
·90 lines (74 loc) · 2.92 KB
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
#!/usr/bin/env python3
"""
Development setup script for SafeHands Senior AI Assistant
"""
import os
import sys
from pathlib import Path
def setup_environment():
"""Set up the development environment"""
print("🚀 SafeHands Senior AI Assistant - Development Setup")
print("=" * 50)
# Check if .env exists
env_file = Path(".env")
if not env_file.exists():
print("📝 Creating .env file from template...")
env_example = Path("env.example")
if env_example.exists():
env_file.write_text(env_example.read_text())
print("✅ .env file created from env.example")
else:
print("❌ env.example not found")
return False
else:
print("✅ .env file already exists")
# Get OpenAI API key
print("\n🔑 OpenAI API Key Setup")
print("You need an OpenAI API key to use the AI features.")
print("Get your API key from: https://platform.openai.com/api-keys")
current_key = os.getenv("OPENAI_API_KEY")
if current_key:
print(f"Current API key: {'*' * 20}{current_key[-4:]}")
use_current = input("Use current API key? (y/N): ").lower().strip()
if use_current == 'y':
return True
api_key = input("Enter your OpenAI API key (sk-...): ").strip()
if not api_key.startswith("sk-"):
print("❌ Invalid API key format. Should start with 'sk-'")
return False
# Update .env file
print("📝 Updating .env file...")
env_content = env_file.read_text()
# Replace the OpenAI API key
lines = env_content.split('\n')
for i, line in enumerate(lines):
if line.startswith("OPENAI_API_KEY="):
lines[i] = f"OPENAI_API_KEY={api_key}"
break
env_file.write_text('\n'.join(lines))
print("✅ .env file updated with your OpenAI API key")
# Set environment variable for current session
os.environ["OPENAI_API_KEY"] = api_key
print("✅ Environment variable set for current session")
return True
def main():
"""Main setup function"""
print("Setting up SafeHands Senior AI Assistant for development...")
# Setup environment
if not setup_environment():
print("❌ Setup failed")
sys.exit(1)
print("\n🎉 Development Setup Complete!")
print("=" * 50)
print("Your SafeHands Senior AI Assistant is ready for development!")
print("\nNext steps:")
print("1. Start the backend: ./start.sh")
print("2. Start the test interface: ./start_test_interface.sh")
print("3. Open http://localhost:3000 to test the web interface")
print("\n📚 Available AI Models:")
print("- GPT-3.5-turbo: Text generation and intent recognition")
print("- GPT-4-Vision: Image analysis and screen understanding")
print("- Whisper: Speech-to-text transcription")
print("- TTS: Text-to-speech generation")
if __name__ == "__main__":
main()