Spaces:
Sleeping
Sleeping
| """ | |
| Demo script to showcase the AI Project Assistant capabilities. | |
| """ | |
| import os | |
| from pathlib import Path | |
| from dotenv import load_dotenv | |
| from src.rag import ProjectRAG | |
| from src.agent import ProjectAgent | |
| # Load environment variables | |
| load_dotenv() | |
| def main(): | |
| """Run the demo.""" | |
| print("=" * 60) | |
| print("AI Project Assistant - Demo") | |
| print("=" * 60) | |
| # Check for API key | |
| if not os.getenv("GOOGLE_API_KEY"): | |
| print("\n⚠️ ERROR: GOOGLE_API_KEY not found!") | |
| print("Please create a .env file with your Google API key:") | |
| print(" GOOGLE_API_KEY=your_key_here") | |
| print("\nGet your API key from: https://aistudio.google.com/apikey") | |
| return | |
| # Initialize RAG system | |
| print("\n📁 Initializing RAG system...") | |
| data_dir = Path("./data") | |
| rag = ProjectRAG(data_dir) | |
| rag.load_and_index() | |
| if not rag.meetings: | |
| print("\n⚠️ No meetings found!") | |
| print("Please add meeting notes to the data directory.") | |
| return | |
| print(f"✅ Loaded {len(rag.meetings)} meetings") | |
| print(f"✅ Projects: {', '.join(rag.get_all_projects())}") | |
| # Initialize agent | |
| print("\n🤖 Initializing AI Agent...") | |
| agent = ProjectAgent(rag) | |
| print("✅ Agent ready!") | |
| # Demo queries | |
| demo_queries = [ | |
| "What are all the open action items?", | |
| "What blockers do we have across all projects?", | |
| "What is the status of the AI model training project?", | |
| "What should the team focus on next for the mobile app redesign?", | |
| ] | |
| print("\n" + "=" * 60) | |
| print("Running Demo Queries") | |
| print("=" * 60) | |
| for i, query in enumerate(demo_queries, 1): | |
| print(f"\n📝 Query {i}: {query}") | |
| print("-" * 60) | |
| answer = agent.query(query) | |
| print(answer) | |
| print() | |
| # Interactive mode | |
| print("\n" + "=" * 60) | |
| print("Interactive Mode - Ask your own questions!") | |
| print("(Type 'quit' or 'exit' to end)") | |
| print("=" * 60) | |
| while True: | |
| try: | |
| user_query = input("\n💬 Your question: ").strip() | |
| if user_query.lower() in ['quit', 'exit', 'q']: | |
| print("\n👋 Thanks for using AI Project Assistant!") | |
| break | |
| if not user_query: | |
| continue | |
| print("\n🤖 Assistant:", end=" ") | |
| answer = agent.query(user_query) | |
| print(answer) | |
| except KeyboardInterrupt: | |
| print("\n\n👋 Thanks for using AI Project Assistant!") | |
| break | |
| except Exception as e: | |
| print(f"\n❌ Error: {e}") | |
| if __name__ == "__main__": | |
| main() |