#!/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())