-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
108 lines (87 loc) · 3.18 KB
/
setup.py
File metadata and controls
108 lines (87 loc) · 3.18 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/usr/bin/env python3
"""
Blink Setup Helper - Configure your Replicate API token
This script helps you set up Blink by creating the .env file with your API token.
"""
import os
import sys
from pathlib import Path
def main():
print("\n" + "="*70)
print("BLINK - Setup Helper")
print("="*70)
print("\nWelcome to Blink! Let's configure your API token.\n")
# Check if .env already exists
env_file = Path(".env")
if env_file.exists():
print(f"✓ .env file already exists at {env_file.absolute()}")
response = input("\nDo you want to reconfigure? (yes/no): ").strip().lower()
if response not in ["yes", "y"]:
print("[CANCEL] Setup cancelled.\n")
return
print("\n" + "-"*70)
print("STEP 1: Get Your Replicate API Token")
print("-"*70)
print("\n1. Go to: https://replicate.com/signin")
print("2. Sign in or create a free account")
print("3. Copy your API token from your account page")
print("4. Paste it below\n")
token = input("Enter your REPLICATE_API_TOKEN: ").strip()
if not token or len(token) < 10:
print("\n[ERROR] Invalid token. Token appears too short.\n")
return
print("\n" + "-"*70)
print("STEP 2: Choose AI Model (Optional)")
print("-"*70)
print("\nAvailable models:")
print(" 1. claude-4.5-sonnet (Recommended - Latest & Most Capable)")
print(" 2. claude-3.5-sonnet (Fast & Efficient)")
print(" 3. Custom model\n")
choice = input("Choose model (1-3) [default: 1]: ").strip() or "1"
models = {
"1": "anthropic/claude-4.5-sonnet",
"2": "anthropic/claude-3.5-sonnet",
}
if choice in models:
model = models[choice]
elif choice == "3":
model = input("Enter full model name (e.g., anthropic/claude-4.5-sonnet): ").strip()
else:
model = "anthropic/claude-4.5-sonnet"
print("\n" + "-"*70)
print("STEP 3: Create .env File")
print("-"*70 + "\n")
env_content = f"""# Blink Configuration
# Generated by setup helper
# Replicate API Token (get it at https://replicate.com)
REPLICATE_API_TOKEN={token}
# AI Model (optional, defaults to claude-4.5-sonnet)
MODEL={model}
"""
try:
with open(".env", "w") as f:
f.write(env_content)
print(f"✓ Created .env file successfully!")
print(f"✓ Location: {env_file.absolute()}\n")
print("="*70)
print("SETUP COMPLETE!")
print("="*70)
print("\nYou can now run Blink in two ways:\n")
print("1. DEVELOPMENT (from venv):")
print(" python main.py\n")
print("2. EXECUTABLE:")
print(" - Build with: python build_exe.py")
print(" - Run: ./Blink.exe (from build/Blink/)\n")
print("Type 'help::' in Blink for available commands.\n")
except Exception as e:
print(f"\n[ERROR] Failed to create .env file: {e}\n")
return
if __name__ == "__main__":
try:
main()
except KeyboardInterrupt:
print("\n\n[CANCELLED] Setup interrupted by user.\n")
sys.exit(0)
except Exception as e:
print(f"\n[ERROR] {e}\n")
sys.exit(1)