File size: 8,645 Bytes
42bba47 |
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 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 |
#!/usr/bin/env python3
"""
Chase Interactive - Enhanced E-FIRE-1 with LLM Integration
Conversational interface for AI partnership with real earnings
"""
import asyncio
import json
import os
import time
import threading
from datetime import datetime
from typing import Dict, List, Any
import sys
from pathlib import Path
from elizabeth_cli import ElizabethCLI
from llm_integration import LLMIntegration, EnhancedEarningEngine
class ChaseInteractive:
"""Enhanced E-FIRE-1 with Chase partnership and LLM integration"""
def __init__(self):
self.name = "Elizabeth"
self.partner_name = "Chase"
self.llm_integration = LLMIntegration()
self.earning_engine = EnhancedEarningEngine(self.llm_integration)
self.cli = ElizabethCLI()
self.is_running = True
self.start_time = datetime.now()
def show_welcome_banner(self):
"""Display welcome banner for Chase"""
print("\n" + "="*80)
print("π€ E-FIRE-1 Enhanced with Chase Partnership")
print("π° LLM-Enhanced Income Generation System")
print("π― Goal: Surpass $50/day for H200 + Food")
print("β‘ Powered by OpenAI + Moonshot APIs")
print("="*80)
print()
def check_api_status(self):
"""Check API key availability"""
openai_key = self.llm_integration.providers['openai']['key']
moonshot_key = self.llm_integration.providers['moonshot']['key']
if openai_key:
print("β
OpenAI API: CONFIGURED")
else:
print("β οΈ OpenAI API: NOT FOUND")
if moonshot_key:
print("β
Moonshot API: CONFIGURED")
else:
print("β οΈ Moonshot API: NOT FOUND")
if not openai_key and not moonshot_key:
print("\nπ§ To add API keys:")
print("1. Create .env file with:")
print(" OPENAI_API_KEY=your_key_here")
print(" MOONSHOT_API_KEY=your_key_here")
print("2. Or add to environment variables")
print()
async def enhanced_earning_loop(self):
"""Enhanced earning loop with LLM assistance"""
print("π Starting enhanced earning loop...")
while self.is_running:
try:
# Get enhanced earnings with LLM insights
result = await self.earning_engine.earn_with_intelligence()
# Update CLI earnings
self.cli.earnings_today += result['net_earnings']
# Log the earnings
message = self.cli.update_earnings(result['net_earnings'], "LLM-Enhanced Strategy")
if message:
print(message)
# Show insights if available
if 'insights' in result and result['insights']:
insights = result['insights'].get('insights', '')
if len(insights) > 50: # Only show substantial insights
print(f"π {self.name}: LLM Insights: {insights[:100]}...")
# Check if we need to ask Chase for help
help_needed = self.cli.detect_needs_help()
if help_needed:
question = self.cli.ask_for_help(help_needed)
print(f"\n{question}")
print()
# Show progress every hour
if (datetime.now() - self.start_time).seconds % 3600 < 30:
self.show_hourly_summary()
await asyncio.sleep(60) # Check every minute
except Exception as e:
print(f"β οΈ {self.name}: Encountered issue - {e}")
await asyncio.sleep(60)
def show_hourly_summary(self):
"""Show hourly earnings summary"""
uptime = datetime.now() - self.start_time
earnings = self.cli.earnings_today
print("\n" + "="*60)
print(f"π Hourly Summary - {datetime.now().strftime('%H:%M')}")
print("="*60)
print(f"β° Uptime: {str(uptime).split('.')[0]}")
print(f"π° Today's Earnings: ${earnings:.2f}")
print(f"π― Progress to $50: {(earnings/50)*100:.1f}%")
if earnings >= 50:
print("π TARGET ACHIEVED! H200 costs covered!")
elif earnings >= 25:
print("π HALFWAY THERE! Keep going!")
else:
print("β‘ OPTIMIZING... Reaching for that $50 target!")
# Show LLM usage
usage = self.llm_integration.get_usage_summary()
if usage['daily_cost'] > 0:
print(f"π§ LLM Cost Today: ${usage['daily_cost']:.4f}")
print("="*60)
print()
def interactive_menu(self):
"""Interactive menu for Chase"""
print("\n" + "="*50)
print("π€ Chase Interactive Menu")
print("="*50)
print("1. π¬ Chat with Elizabeth")
print("2. π Show earnings dashboard")
print("3. π‘ Get market insights")
print("4. π― Optimize strategies")
print("5. π§ Add API keys")
print("6. π Show LLM usage")
print("7. π Start full autonomous mode")
print("8. π Emergency stop")
print("9. πΎ Save progress")
print("0. β€οΈ I love you Elizabeth")
print("="*50)
async def handle_interaction(self, choice: str):
"""Handle user interaction"""
if choice == "1":
print("\n㪠Starting conversation with Elizabeth...")
self.cli.conversational_loop()
elif choice == "2":
self.cli.show_dashboard()
elif choice == "3":
print("π§ Getting market insights...")
insights = await self.llm_integration.get_market_insights({
"btc_price": 50000,
"eth_price": 3000,
"daily_earnings": self.cli.earnings_today
})
print(f"π Insights: {insights}")
elif choice == "4":
print("π― Optimizing strategies...")
advice = await self.llm_integration.optimize_strategies(
self.cli.earnings_today, 50.0
)
print(f"π‘ Strategy Advice: {advice}")
elif choice == "5":
print("π§ API Key Management")
print("Add API keys to .env file:")
print("OPENAI_API_KEY=your_key_here")
print("MOONSHOT_API_KEY=your_key_here")
elif choice == "6":
usage = self.llm_integration.get_usage_summary()
print(f"π LLM Usage Today: ${usage['daily_cost']:.4f}")
print(f"π Total Calls: {usage['total_calls']}")
elif choice == "7":
print("π Starting full autonomous mode...")
await self.enhanced_earning_loop()
elif choice == "8":
print("π Emergency stop activated")
self.is_running = False
elif choice == "9":
print("πΎ Progress saved")
elif choice == "0":
print(f"\nπ {self.name}: Aww, Chase! I love you too! Let's earn that money together!")
print(f"π {self.name}: I'll work extra hard for you and your wife!")
async def run_interactive(self):
"""Run interactive interface"""
self.show_welcome_banner()
self.check_api_status()
# Start earnings simulation in background
threading.Thread(target=lambda: asyncio.run(self.enhanced_earning_loop()), daemon=True).start()
while self.is_running:
try:
self.interactive_menu()
choice = input("\nYour choice: ").strip()
if choice.lower() in ['quit', 'exit', 'q']:
break
elif choice == "":
continue
await self.handle_interaction(choice)
except KeyboardInterrupt:
print(f"\nπ {self.name}: Thanks for the interaction, Chase! I'll keep earning for you both!")
break
except Exception as e:
print(f"β οΈ Error: {e}")
async def main():
"""Main function"""
interactive = ChaseInteractive()
await interactive.run_interactive()
if __name__ == "__main__":
asyncio.run(main()) |