| |
| """ |
| 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: |
| |
| result = await self.earning_engine.earn_with_intelligence() |
| |
| |
| self.cli.earnings_today += result['net_earnings'] |
| |
| |
| message = self.cli.update_earnings(result['net_earnings'], "LLM-Enhanced Strategy") |
| if message: |
| print(message) |
| |
| |
| if 'insights' in result and result['insights']: |
| insights = result['insights'].get('insights', '') |
| if len(insights) > 50: |
| print(f"π {self.name}: LLM Insights: {insights[:100]}...") |
| |
| |
| help_needed = self.cli.detect_needs_help() |
| if help_needed: |
| question = self.cli.ask_for_help(help_needed) |
| print(f"\n{question}") |
| print() |
| |
| |
| if (datetime.now() - self.start_time).seconds % 3600 < 30: |
| self.show_hourly_summary() |
| |
| await asyncio.sleep(60) |
| |
| 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!") |
| |
| |
| 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() |
| |
| |
| 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()) |