File size: 3,488 Bytes
f104fee
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/usr/bin/env python3

import sys
import os

sys.path.insert(0, os.path.dirname(__file__))

def test_imports():
    try:
        print("Testing imports...")
        
        # Test basic Python modules
        import json
        import asyncio
        from datetime import datetime
        from typing import List, Tuple
        print("βœ… Basic Python modules imported successfully")
        
        # Test installed packages
        import gradio as gr
        print("βœ… Gradio imported successfully")
        
        import aiohttp
        print("βœ… aiohttp imported successfully")
        
        import plotly
        print("βœ… Plotly imported successfully")
        
        import pandas
        print("βœ… Pandas imported successfully")
        
        import pydantic
        print("βœ… Pydantic imported successfully")
        
        # Test LangChain
        import langchain
        from langchain.agents import AgentExecutor
        from langchain_google_genai import ChatGoogleGenerativeAI
        print("βœ… LangChain modules imported successfully")
        
        # Test our modules
        from src.utils.config import config
        from src.utils.logger import get_logger
        print("βœ… Config and logger imported successfully")
        
        from src.tools.base_tool import BaseWeb3Tool
        from src.tools.coingecko_tool import CoinGeckoTool
        from src.tools.defillama_tool import DeFiLlamaTool
        from src.tools.etherscan_tool import EtherscanTool
        print("βœ… Tools imported successfully")
        
        from src.agent.research_agent import Web3ResearchAgent
        from src.agent.query_planner import QueryPlanner
        print("βœ… Agent modules imported successfully")
        
        from src.api.airaa_integration import AIRAAIntegration
        print("βœ… AIRAA integration imported successfully")
        
        from src.visualizations import create_price_chart, create_market_overview
        print("βœ… Visualizations imported successfully")
        
        # Test app import
        from app import Web3CoPilotApp
        print("βœ… Main app imported successfully")
        
        print("\nπŸŽ‰ All imports successful! The application is ready to run.")
        return True
        
    except ImportError as e:
        print(f"❌ Import error: {e}")
        return False
    except Exception as e:
        print(f"❌ Unexpected error: {e}")
        return False

def test_app_initialization():
    try:
        print("\nTesting app initialization...")
        # This will test if we can create the app instance
        # but won't actually run it
        os.environ.setdefault('GEMINI_API_KEY', 'test_key_for_import_test')
        
        from app import Web3CoPilotApp
        print("βœ… App class imported successfully")
        
        # Test if we can create the interface (but don't launch)
        app = Web3CoPilotApp()
        interface = app.create_interface()
        print("βœ… App interface created successfully")
        
        print("\nπŸš€ Application is fully functional and ready to launch!")
        return True
        
    except Exception as e:
        print(f"❌ App initialization error: {e}")
        return False

if __name__ == "__main__":
    print("=" * 60)
    print("Web3 Research Co-Pilot - Application Test")
    print("=" * 60)
    
    success = test_imports()
    if success:
        test_app_initialization()
    
    print("=" * 60)
    print("Test complete!")