Upload 2 files
Browse files- app.py +483 -63
- requirements.txt +18 -19
app.py
CHANGED
|
@@ -4,10 +4,11 @@ Combining ALL advanced features with REAL MCP Integration
|
|
| 4 |
The definitive competition-winning submission!
|
| 5 |
"""
|
| 6 |
import asyncio
|
| 7 |
-
import httpx
|
| 8 |
import json
|
| 9 |
import gradio as gr
|
| 10 |
import time
|
|
|
|
| 11 |
from datetime import datetime
|
| 12 |
from typing import List, Dict, Any, Optional, Tuple
|
| 13 |
from dataclasses import dataclass, asdict
|
|
@@ -614,10 +615,262 @@ class UltimateTopcoderMCPEngine:
|
|
| 614 |
}
|
| 615 |
}
|
| 616 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 617 |
# Initialize the ULTIMATE intelligence engine
|
| 618 |
print("🚀 Starting ULTIMATE Topcoder Intelligence Assistant...")
|
| 619 |
intelligence_engine = UltimateTopcoderMCPEngine()
|
| 620 |
|
|
|
|
|
|
|
|
|
|
| 621 |
def format_challenge_card(challenge: Dict) -> str:
|
| 622 |
"""Format challenge as professional HTML card with enhanced styling"""
|
| 623 |
|
|
@@ -834,46 +1087,151 @@ def get_ultimate_recommendations_sync(skills_input: str, experience_level: str,
|
|
| 834 |
"""Synchronous wrapper for Gradio"""
|
| 835 |
return asyncio.run(get_ultimate_recommendations_async(skills_input, experience_level, time_available, interests))
|
| 836 |
|
| 837 |
-
|
| 838 |
-
|
| 839 |
-
|
|
|
|
|
|
|
| 840 |
|
| 841 |
-
|
| 842 |
-
|
| 843 |
-
|
| 844 |
-
|
| 845 |
-
|
| 846 |
-
|
| 847 |
-
|
| 848 |
-
|
| 849 |
-
|
| 850 |
-
|
| 851 |
-
|
| 852 |
-
|
| 853 |
-
|
| 854 |
-
|
| 855 |
-
|
| 856 |
-
|
| 857 |
|
| 858 |
-
|
| 859 |
-
|
| 860 |
-
|
| 861 |
|
| 862 |
-
|
| 863 |
-
|
| 864 |
-
|
| 865 |
-
|
| 866 |
-
|
| 867 |
|
| 868 |
-
|
| 869 |
-
|
| 870 |
-
|
| 871 |
|
| 872 |
-
|
| 873 |
-
|
| 874 |
-
|
| 875 |
|
| 876 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 877 |
|
| 878 |
def run_ultimate_performance_test():
|
| 879 |
"""ULTIMATE comprehensive system performance test"""
|
|
@@ -1135,55 +1493,117 @@ def create_ultimate_interface():
|
|
| 1135 |
)
|
| 1136 |
|
| 1137 |
# Tab 2: ULTIMATE Chat Assistant
|
| 1138 |
-
with gr.TabItem("💬 ULTIMATE AI Assistant"):
|
| 1139 |
-
|
| 1140 |
-
|
| 1141 |
|
| 1142 |
-
|
| 1143 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1144 |
|
| 1145 |
-
|
| 1146 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1147 |
height=500,
|
| 1148 |
-
placeholder="Hi! I'm your
|
| 1149 |
show_label=True
|
| 1150 |
)
|
| 1151 |
|
| 1152 |
with gr.Row():
|
| 1153 |
-
|
| 1154 |
-
placeholder="
|
| 1155 |
container=False,
|
| 1156 |
scale=4,
|
| 1157 |
show_label=False
|
| 1158 |
)
|
| 1159 |
-
|
| 1160 |
|
| 1161 |
-
#
|
| 1162 |
gr.Examples(
|
| 1163 |
examples=[
|
| 1164 |
-
"
|
| 1165 |
-
"
|
| 1166 |
-
"
|
| 1167 |
-
"What
|
| 1168 |
-
"
|
| 1169 |
-
"
|
| 1170 |
],
|
| 1171 |
-
inputs=
|
| 1172 |
)
|
| 1173 |
|
| 1174 |
-
# Connect
|
| 1175 |
-
|
| 1176 |
-
|
| 1177 |
-
inputs=[
|
| 1178 |
-
outputs=[
|
| 1179 |
)
|
| 1180 |
|
| 1181 |
-
|
| 1182 |
-
|
| 1183 |
-
inputs=[
|
| 1184 |
-
outputs=[
|
| 1185 |
)
|
| 1186 |
|
|
|
|
| 1187 |
# Tab 3: ULTIMATE Performance & Technical Details
|
| 1188 |
with gr.TabItem("⚡ ULTIMATE Performance"):
|
| 1189 |
gr.Markdown("""
|
|
|
|
| 4 |
The definitive competition-winning submission!
|
| 5 |
"""
|
| 6 |
import asyncio
|
| 7 |
+
import httpx # FIXED: Added missing httpx import
|
| 8 |
import json
|
| 9 |
import gradio as gr
|
| 10 |
import time
|
| 11 |
+
import os
|
| 12 |
from datetime import datetime
|
| 13 |
from typing import List, Dict, Any, Optional, Tuple
|
| 14 |
from dataclasses import dataclass, asdict
|
|
|
|
| 615 |
}
|
| 616 |
}
|
| 617 |
|
| 618 |
+
class EnhancedLLMChatbot:
|
| 619 |
+
"""Enhanced LLM Chatbot with Real MCP Data Integration using OpenAI"""
|
| 620 |
+
|
| 621 |
+
def __init__(self, mcp_engine):
|
| 622 |
+
self.mcp_engine = mcp_engine
|
| 623 |
+
self.conversation_context = []
|
| 624 |
+
self.user_preferences = {}
|
| 625 |
+
|
| 626 |
+
# Initialize OpenAI API key
|
| 627 |
+
self.openai_api_key = os.getenv('OPENAI_API_KEY') or "your-openai-api-key-here"
|
| 628 |
+
|
| 629 |
+
if not self.openai_api_key or self.openai_api_key == "your-openai-api-key-here":
|
| 630 |
+
print("⚠️ OpenAI API key not set. LLM will use enhanced fallback responses.")
|
| 631 |
+
self.llm_available = False
|
| 632 |
+
else:
|
| 633 |
+
self.llm_available = True
|
| 634 |
+
print("✅ OpenAI API key configured for intelligent responses")
|
| 635 |
+
|
| 636 |
+
async def get_challenge_context(self, query: str, limit: int = 10) -> str:
|
| 637 |
+
"""Get relevant challenge data for LLM context"""
|
| 638 |
+
try:
|
| 639 |
+
# Fetch real challenges from your working MCP
|
| 640 |
+
challenges = await self.mcp_engine.fetch_real_challenges(limit=limit)
|
| 641 |
+
|
| 642 |
+
if not challenges:
|
| 643 |
+
return "Using premium challenge dataset for analysis."
|
| 644 |
+
|
| 645 |
+
# Create rich context from real data
|
| 646 |
+
context_data = {
|
| 647 |
+
"total_challenges_available": "4,596+",
|
| 648 |
+
"sample_challenges": []
|
| 649 |
+
}
|
| 650 |
+
|
| 651 |
+
for challenge in challenges[:5]: # Top 5 for context
|
| 652 |
+
challenge_info = {
|
| 653 |
+
"id": challenge.id,
|
| 654 |
+
"title": challenge.title,
|
| 655 |
+
"description": challenge.description[:200] + "...",
|
| 656 |
+
"technologies": challenge.technologies,
|
| 657 |
+
"difficulty": challenge.difficulty,
|
| 658 |
+
"prize": challenge.prize,
|
| 659 |
+
"registrants": challenge.registrants,
|
| 660 |
+
"category": getattr(challenge, 'category', 'Development')
|
| 661 |
+
}
|
| 662 |
+
context_data["sample_challenges"].append(challenge_info)
|
| 663 |
+
|
| 664 |
+
return json.dumps(context_data, indent=2)
|
| 665 |
+
|
| 666 |
+
except Exception as e:
|
| 667 |
+
return f"Challenge data temporarily unavailable: {str(e)}"
|
| 668 |
+
|
| 669 |
+
async def generate_llm_response(self, user_message: str, chat_history: List) -> str:
|
| 670 |
+
"""Generate intelligent response using OpenAI API with real MCP data"""
|
| 671 |
+
|
| 672 |
+
# Get real challenge context
|
| 673 |
+
challenge_context = await self.get_challenge_context(user_message)
|
| 674 |
+
|
| 675 |
+
# Build conversation context
|
| 676 |
+
recent_history = chat_history[-4:] if len(chat_history) > 4 else chat_history
|
| 677 |
+
history_text = "\n".join([f"User: {h[0]}\nAssistant: {h[1]}" for h in recent_history])
|
| 678 |
+
|
| 679 |
+
# Create comprehensive prompt for LLM
|
| 680 |
+
system_prompt = f"""You are an expert Topcoder Challenge Intelligence Assistant with REAL-TIME access to live challenge data through MCP integration.
|
| 681 |
+
|
| 682 |
+
REAL CHALLENGE DATA CONTEXT:
|
| 683 |
+
{challenge_context}
|
| 684 |
+
|
| 685 |
+
Your capabilities:
|
| 686 |
+
- Access to 4,596+ live Topcoder challenges through real MCP integration
|
| 687 |
+
- Advanced challenge matching algorithms with multi-factor scoring
|
| 688 |
+
- Real-time prize information, difficulty levels, and technology requirements
|
| 689 |
+
- Comprehensive skill analysis and career guidance
|
| 690 |
+
- Market intelligence and technology trend insights
|
| 691 |
+
|
| 692 |
+
CONVERSATION HISTORY:
|
| 693 |
+
{history_text}
|
| 694 |
+
|
| 695 |
+
Guidelines:
|
| 696 |
+
- Use the REAL challenge data provided above in your responses
|
| 697 |
+
- Reference actual challenge titles, prizes, and technologies when relevant
|
| 698 |
+
- Provide specific, actionable advice based on real data
|
| 699 |
+
- Mention that your data comes from live MCP integration with Topcoder
|
| 700 |
+
- Be enthusiastic about the real-time data capabilities
|
| 701 |
+
- If asked about specific technologies, reference actual challenges that use them
|
| 702 |
+
- For skill questions, suggest real challenges that match their level
|
| 703 |
+
- Keep responses concise but informative (max 300 words)
|
| 704 |
+
|
| 705 |
+
User's current question: {user_message}
|
| 706 |
+
|
| 707 |
+
Provide a helpful, intelligent response using the real challenge data context."""
|
| 708 |
+
|
| 709 |
+
# Try OpenAI API if available
|
| 710 |
+
if self.llm_available:
|
| 711 |
+
try:
|
| 712 |
+
async with httpx.AsyncClient(timeout=30.0) as client:
|
| 713 |
+
response = await client.post(
|
| 714 |
+
"https://api.openai.com/v1/chat/completions",
|
| 715 |
+
headers={
|
| 716 |
+
"Content-Type": "application/json",
|
| 717 |
+
"Authorization": f"Bearer {self.openai_api_key}"
|
| 718 |
+
},
|
| 719 |
+
json={
|
| 720 |
+
"model": "gpt-4o-mini", # Fast and cost-effective
|
| 721 |
+
"messages": [
|
| 722 |
+
{"role": "system", "content": "You are an expert Topcoder Challenge Intelligence Assistant with real MCP data access."},
|
| 723 |
+
{"role": "user", "content": system_prompt}
|
| 724 |
+
],
|
| 725 |
+
"max_tokens": 800,
|
| 726 |
+
"temperature": 0.7
|
| 727 |
+
}
|
| 728 |
+
)
|
| 729 |
+
|
| 730 |
+
if response.status_code == 200:
|
| 731 |
+
data = response.json()
|
| 732 |
+
llm_response = data["choices"][0]["message"]["content"]
|
| 733 |
+
|
| 734 |
+
# Add real-time data indicators
|
| 735 |
+
llm_response += f"\n\n*🤖 Powered by OpenAI GPT-4 + Real MCP Data • {len(challenge_context)} chars of live context*"
|
| 736 |
+
|
| 737 |
+
return llm_response
|
| 738 |
+
else:
|
| 739 |
+
print(f"OpenAI API error: {response.status_code}")
|
| 740 |
+
return await self.get_fallback_response_with_context(user_message, challenge_context)
|
| 741 |
+
|
| 742 |
+
except Exception as e:
|
| 743 |
+
print(f"OpenAI API error: {e}")
|
| 744 |
+
return await self.get_fallback_response_with_context(user_message, challenge_context)
|
| 745 |
+
|
| 746 |
+
# Fallback to enhanced responses with real data
|
| 747 |
+
return await self.get_fallback_response_with_context(user_message, challenge_context)
|
| 748 |
+
|
| 749 |
+
async def get_fallback_response_with_context(self, user_message: str, challenge_context: str) -> str:
|
| 750 |
+
"""Enhanced fallback using real challenge data"""
|
| 751 |
+
message_lower = user_message.lower()
|
| 752 |
+
|
| 753 |
+
# Parse challenge context for intelligent responses
|
| 754 |
+
try:
|
| 755 |
+
context_data = json.loads(challenge_context)
|
| 756 |
+
challenges = context_data.get("sample_challenges", [])
|
| 757 |
+
except:
|
| 758 |
+
challenges = []
|
| 759 |
+
|
| 760 |
+
# Technology-specific responses using real data
|
| 761 |
+
tech_keywords = ['python', 'react', 'javascript', 'blockchain', 'ai', 'ml', 'java', 'nodejs', 'angular', 'vue']
|
| 762 |
+
matching_tech = [tech for tech in tech_keywords if tech in message_lower]
|
| 763 |
+
|
| 764 |
+
if matching_tech:
|
| 765 |
+
relevant_challenges = []
|
| 766 |
+
for challenge in challenges:
|
| 767 |
+
challenge_techs = [tech.lower() for tech in challenge.get('technologies', [])]
|
| 768 |
+
if any(tech in challenge_techs for tech in matching_tech):
|
| 769 |
+
relevant_challenges.append(challenge)
|
| 770 |
+
|
| 771 |
+
if relevant_challenges:
|
| 772 |
+
response = f"Great question about {', '.join(matching_tech)}! 🚀 Based on my real MCP data access, here are actual challenges:\n\n"
|
| 773 |
+
for i, challenge in enumerate(relevant_challenges[:3], 1):
|
| 774 |
+
response += f"🎯 **{challenge['title']}**\n"
|
| 775 |
+
response += f" 💰 Prize: {challenge['prize']}\n"
|
| 776 |
+
response += f" 🛠️ Technologies: {', '.join(challenge['technologies'])}\n"
|
| 777 |
+
response += f" 📊 Difficulty: {challenge['difficulty']}\n"
|
| 778 |
+
response += f" 👥 Registrants: {challenge['registrants']}\n\n"
|
| 779 |
+
|
| 780 |
+
response += f"*These are REAL challenges from my live MCP connection to Topcoder's database of 4,596+ challenges!*"
|
| 781 |
+
return response
|
| 782 |
+
|
| 783 |
+
# Prize/earning questions with real data
|
| 784 |
+
if any(word in message_lower for word in ['prize', 'money', 'earn', 'pay', 'salary', 'income']):
|
| 785 |
+
if challenges:
|
| 786 |
+
response = f"💰 Based on real MCP data, current Topcoder challenges offer:\n\n"
|
| 787 |
+
for i, challenge in enumerate(challenges[:3], 1):
|
| 788 |
+
response += f"{i}. **{challenge['title']}** - {challenge['prize']}\n"
|
| 789 |
+
response += f" 📊 Difficulty: {challenge['difficulty']} | 👥 Competition: {challenge['registrants']} registered\n\n"
|
| 790 |
+
response += f"*This is live prize data from {context_data.get('total_challenges_available', '4,596+')} real challenges!*"
|
| 791 |
+
return response
|
| 792 |
+
|
| 793 |
+
# Career/skill questions
|
| 794 |
+
if any(word in message_lower for word in ['career', 'skill', 'learn', 'beginner', 'advanced', 'help']):
|
| 795 |
+
if challenges:
|
| 796 |
+
sample_challenge = challenges[0]
|
| 797 |
+
return f"""I'm your intelligent Topcoder assistant with REAL MCP integration! 🚀
|
| 798 |
+
|
| 799 |
+
I currently have live access to {context_data.get('total_challenges_available', '4,596+')} real challenges. For example, right now there's:
|
| 800 |
+
|
| 801 |
+
🎯 **"{sample_challenge['title']}"**
|
| 802 |
+
💰 Prize: **{sample_challenge['prize']}**
|
| 803 |
+
🛠️ Technologies: {', '.join(sample_challenge['technologies'][:3])}
|
| 804 |
+
📊 Difficulty: {sample_challenge['difficulty']}
|
| 805 |
+
|
| 806 |
+
I can help you with:
|
| 807 |
+
🎯 Find challenges matching your specific skills
|
| 808 |
+
💰 Compare real prize amounts and competition levels
|
| 809 |
+
📊 Analyze difficulty levels and technology requirements
|
| 810 |
+
🚀 Career guidance based on market demand
|
| 811 |
+
|
| 812 |
+
Try asking me about specific technologies like "Python challenges" or "React opportunities"!
|
| 813 |
+
|
| 814 |
+
*Powered by live MCP connection to Topcoder's challenge database*"""
|
| 815 |
+
|
| 816 |
+
# Default intelligent response with real data
|
| 817 |
+
if challenges:
|
| 818 |
+
return f"""Hi! I'm your intelligent Topcoder assistant! 🤖
|
| 819 |
+
|
| 820 |
+
I have REAL MCP integration with live access to **{context_data.get('total_challenges_available', '4,596+')} challenges** from Topcoder's database.
|
| 821 |
+
|
| 822 |
+
**Currently active challenges include:**
|
| 823 |
+
• **{challenges[0]['title']}** ({challenges[0]['prize']})
|
| 824 |
+
• **{challenges[1]['title']}** ({challenges[1]['prize']})
|
| 825 |
+
• **{challenges[2]['title']}** ({challenges[2]['prize']})
|
| 826 |
+
|
| 827 |
+
Ask me about:
|
| 828 |
+
🎯 Specific technologies (Python, React, blockchain, etc.)
|
| 829 |
+
💰 Prize ranges and earning potential
|
| 830 |
+
📊 Difficulty levels and skill requirements
|
| 831 |
+
🚀 Career advice and skill development
|
| 832 |
+
|
| 833 |
+
*All responses powered by real-time Topcoder MCP data!*"""
|
| 834 |
+
|
| 835 |
+
return "I'm your intelligent Topcoder assistant with real MCP data access! Ask me about challenges, skills, or career advice and I'll help you using live data from 4,596+ real challenges! 🚀"
|
| 836 |
+
|
| 837 |
+
# FIXED: Properly placed standalone functions
|
| 838 |
+
async def chat_with_enhanced_llm_agent(message: str, history: List[Tuple[str, str]]) -> Tuple[List[Tuple[str, str]], str]:
|
| 839 |
+
"""Enhanced chat with real LLM and MCP data integration"""
|
| 840 |
+
print(f"🧠 Enhanced LLM Chat: {message}")
|
| 841 |
+
|
| 842 |
+
# Initialize enhanced chatbot
|
| 843 |
+
if not hasattr(chat_with_enhanced_llm_agent, 'chatbot'):
|
| 844 |
+
chat_with_enhanced_llm_agent.chatbot = EnhancedLLMChatbot(intelligence_engine)
|
| 845 |
+
|
| 846 |
+
chatbot = chat_with_enhanced_llm_agent.chatbot
|
| 847 |
+
|
| 848 |
+
try:
|
| 849 |
+
# Get intelligent response using real MCP data
|
| 850 |
+
response = await chatbot.generate_llm_response(message, history)
|
| 851 |
+
|
| 852 |
+
# Add to history
|
| 853 |
+
history.append((message, response))
|
| 854 |
+
|
| 855 |
+
print(f"✅ Enhanced LLM response generated with real MCP context")
|
| 856 |
+
return history, ""
|
| 857 |
+
|
| 858 |
+
except Exception as e:
|
| 859 |
+
error_response = f"I encountered an issue processing your request: {str(e)}. However, I can still help you with challenge recommendations using my real MCP data! Try asking about specific technologies or challenge types."
|
| 860 |
+
history.append((message, error_response))
|
| 861 |
+
return history, ""
|
| 862 |
+
|
| 863 |
+
def chat_with_enhanced_llm_agent_sync(message: str, history: List[Tuple[str, str]]) -> Tuple[List[Tuple[str, str]], str]:
|
| 864 |
+
"""Synchronous wrapper for Gradio"""
|
| 865 |
+
return asyncio.run(chat_with_enhanced_llm_agent(message, history))
|
| 866 |
+
|
| 867 |
# Initialize the ULTIMATE intelligence engine
|
| 868 |
print("🚀 Starting ULTIMATE Topcoder Intelligence Assistant...")
|
| 869 |
intelligence_engine = UltimateTopcoderMCPEngine()
|
| 870 |
|
| 871 |
+
# Rest of your code remains exactly the same...
|
| 872 |
+
# (All the formatting functions, recommendation functions, interface creation, etc.)
|
| 873 |
+
|
| 874 |
def format_challenge_card(challenge: Dict) -> str:
|
| 875 |
"""Format challenge as professional HTML card with enhanced styling"""
|
| 876 |
|
|
|
|
| 1087 |
"""Synchronous wrapper for Gradio"""
|
| 1088 |
return asyncio.run(get_ultimate_recommendations_async(skills_input, experience_level, time_available, interests))
|
| 1089 |
|
| 1090 |
+
# Rest of your performance test and interface functions remain the same...
|
| 1091 |
+
# (I'm truncating here due to length, but all the rest of your code stays exactly as-is)
|
| 1092 |
+
# def chat_with_ultimate_agent(message: str, history: List[Tuple[str, str]]) -> Tuple[List[Tuple[str, str]], str]:
|
| 1093 |
+
# """ULTIMATE enhanced chat functionality with MCP awareness"""
|
| 1094 |
+
# print(f"💬 Ultimate Chat: {message}")
|
| 1095 |
|
| 1096 |
+
# # Enhanced response system with MCP integration awareness
|
| 1097 |
+
# responses = {
|
| 1098 |
+
# "hello": "Hi there! 🚀 I'm your ULTIMATE Topcoder Challenge Intelligence Assistant! I have REAL MCP integration with live access to 4,596+ challenges. I help developers discover perfect challenges using advanced AI algorithms. Try the recommendations tab to experience the magic!",
|
| 1099 |
+
# "help": "I'm your ultimate AI assistant! 🤖 I can help you:\n\n🎯 Find challenges perfectly matched to your skills using REAL MCP data\n📊 Analyze your developer profile with advanced algorithms\n🚀 Recommend career growth paths based on market trends\n💡 Provide comprehensive insights and success predictions\n\nUse the 'ULTIMATE Recommendations' tab to get started!",
|
| 1100 |
+
# "mcp": "Yes! I have REAL Model Context Protocol integration! 🔥 I connect directly to Topcoder's live MCP server to access 4,596+ real challenges and 6,535+ skills. This means you get authentic, up-to-date challenge data instead of mock examples!",
|
| 1101 |
+
# "real": "Absolutely! Everything I show you comes from REAL Topcoder data! 🎯 I use live MCP session authentication to fetch actual challenges, real prizes, genuine difficulty levels, and current registration numbers. No mock data here!",
|
| 1102 |
+
# "python": "Python is fantastic! 🐍 With my REAL MCP access, I can find actual Python challenges from Topcoder's live database. From FastAPI optimization to machine learning deployment - I'll match you with real opportunities that fit your skill level perfectly!",
|
| 1103 |
+
# "react": "React is hot! ⚛️ I have access to real React challenges from component libraries to full-stack applications. With live MCP data, I can show you actual prizes, current competition levels, and genuine requirements. Want to see some real React opportunities?",
|
| 1104 |
+
# "blockchain": "Blockchain is exploding! 🚀 My MCP integration gives me access to real Web3, Solidity, and smart contract challenges. I can find actual DeFi projects, NFT development challenges, and blockchain integration tasks with real prize pools!",
|
| 1105 |
+
# "ai": "AI is the future! 🤖 Through real MCP data, I can find machine learning, TensorFlow, and AI integration challenges. From model deployment to neural network optimization - all with real Topcoder prizes and requirements!",
|
| 1106 |
+
# "test": "ULTIMATE Systems Status Check! ✅\n\n🔥 Real MCP Integration: OPERATIONAL\n📊 Live Challenge Database: 4,596+ challenges accessible\n🧠 Advanced Intelligence Engine: Multi-factor scoring active\n⚡ Performance: Sub-1-second real-time processing\n🎯 Authentication: Session-based MCP connection established\n🚀 Algorithm Version: Advanced Multi-Factor v2.0\n\nAll systems performing at ULTIMATE level!",
|
| 1107 |
+
# "skills": "I analyze ALL skills with REAL market data! 🎯\n\n💻 Frontend: React, JavaScript, TypeScript, Vue, Angular\n⚙️ Backend: Python, Java, Node.js, FastAPI, Django\n☁️ Cloud: AWS, Azure, Docker, Kubernetes\n🔗 Blockchain: Solidity, Web3, Ethereum, Smart Contracts\n🤖 AI/ML: TensorFlow, PyTorch, Machine Learning\n🎨 Design: UI/UX, Figma, Prototyping\n\nWith live MCP access, I match your skills to REAL challenges with actual prizes!",
|
| 1108 |
+
# "advanced": "Perfect! 💪 With your advanced skills, I can recommend high-value challenges through real MCP data. Think $5,000-$7,500 prizes, complex architectures, and cutting-edge technologies. My advanced algorithms will find challenges that truly challenge and reward your expertise!",
|
| 1109 |
+
# "beginner": "Welcome to your journey! 🌱 I have real beginner-friendly challenges from Topcoder's live database. First2Finish challenges, UI/UX projects, and learning-focused tasks with actual mentorship opportunities. My MCP access ensures you get genuine starter challenges!",
|
| 1110 |
+
# "performance": "My performance is ULTIMATE! ⚡\n\n🚀 Real MCP Data: 0.2-1.0s response times\n🧠 Advanced Scoring: Multi-factor analysis in milliseconds\n📊 Live Database: 4,596+ challenges, 6,535+ skills\n🎯 Success Rate: 95%+ user satisfaction\n💾 Memory Efficient: Optimized for production deployment\n\nI'm built for speed, accuracy, and real-world performance!"
|
| 1111 |
+
# }
|
| 1112 |
|
| 1113 |
+
# # Smart keyword matching with enhanced context
|
| 1114 |
+
# message_lower = message.lower()
|
| 1115 |
+
# response = "That's a fantastic question! 🚀 I'm powered by REAL MCP integration with live Topcoder data. For the most personalized experience, try the 'ULTIMATE Recommendations' tab where I can analyze your specific skills against 4,596+ real challenges using advanced AI algorithms!"
|
| 1116 |
|
| 1117 |
+
# # Enhanced keyword matching
|
| 1118 |
+
# for keyword, reply in responses.items():
|
| 1119 |
+
# if keyword in message_lower:
|
| 1120 |
+
# response = reply
|
| 1121 |
+
# break
|
| 1122 |
|
| 1123 |
+
# # Special handling for prize/money questions
|
| 1124 |
+
# if any(word in message_lower for word in ['prize', 'money', 'pay', 'reward', 'earn']):
|
| 1125 |
+
# response = "Great question about prizes! 💰 With my REAL MCP access, I can show you actual Topcoder challenge prizes ranging from $1,000 to $7,500+! The prizes are genuine - from merit-based learning challenges to high-value enterprise projects. Higher prizes typically mean more complex requirements and greater competition. I match you with challenges where you have the best success probability!"
|
| 1126 |
|
| 1127 |
+
# # Add to chat history
|
| 1128 |
+
# history.append((message, response))
|
| 1129 |
+
# print("✅ Ultimate chat response generated")
|
| 1130 |
|
| 1131 |
+
# return history, ""
|
| 1132 |
+
|
| 1133 |
+
|
| 1134 |
+
# Add this function to replace your current chat function
|
| 1135 |
+
# async def chat_with_enhanced_llm_agent(message: str, history: List[Tuple[str, str]], mcp_engine) -> Tuple[List[Tuple[str, str]], str]:
|
| 1136 |
+
# """Enhanced chat with real LLM and MCP data integration"""
|
| 1137 |
+
# print(f"🧠 Enhanced LLM Chat: {message}")
|
| 1138 |
+
|
| 1139 |
+
# # Initialize enhanced chatbot
|
| 1140 |
+
# if not hasattr(chat_with_enhanced_llm_agent, 'chatbot'):
|
| 1141 |
+
# chat_with_enhanced_llm_agent.chatbot = EnhancedLLMChatbot(mcp_engine)
|
| 1142 |
+
|
| 1143 |
+
# chatbot = chat_with_enhanced_llm_agent.chatbot
|
| 1144 |
+
|
| 1145 |
+
# try:
|
| 1146 |
+
# # Get intelligent response using real MCP data
|
| 1147 |
+
# response = await chatbot.generate_llm_response(message, history)
|
| 1148 |
+
|
| 1149 |
+
# # Add to history
|
| 1150 |
+
# history.append((message, response))
|
| 1151 |
+
|
| 1152 |
+
# print(f"✅ Enhanced LLM response generated with real MCP context")
|
| 1153 |
+
# return history, ""
|
| 1154 |
+
|
| 1155 |
+
# except Exception as e:
|
| 1156 |
+
# error_response = f"I encountered an issue processing your request: {str(e)}. However, I can still help you with challenge recommendations using my real MCP data! Try asking about specific technologies or challenge types."
|
| 1157 |
+
# history.append((message, error_response))
|
| 1158 |
+
# return history, ""
|
| 1159 |
+
async def generate_llm_response(self, user_message: str, chat_history: List) -> str:
|
| 1160 |
+
"""Generate intelligent response using Claude API with real MCP data"""
|
| 1161 |
+
|
| 1162 |
+
# Get real challenge context
|
| 1163 |
+
challenge_context = await self.get_challenge_context(user_message)
|
| 1164 |
+
|
| 1165 |
+
# Build conversation context
|
| 1166 |
+
recent_history = chat_history[-4:] if len(chat_history) > 4 else chat_history
|
| 1167 |
+
history_text = "\n".join([f"User: {h[0]}\nAssistant: {h[1]}" for h in recent_history])
|
| 1168 |
+
|
| 1169 |
+
# Create comprehensive prompt for LLM
|
| 1170 |
+
system_prompt = f"""You are an expert Topcoder Challenge Intelligence Assistant with REAL-TIME access to live challenge data through MCP integration.
|
| 1171 |
+
|
| 1172 |
+
REAL CHALLENGE DATA CONTEXT:
|
| 1173 |
+
{challenge_context}
|
| 1174 |
+
|
| 1175 |
+
Your capabilities:
|
| 1176 |
+
- Access to 4,596+ live Topcoder challenges through real MCP integration
|
| 1177 |
+
- Advanced challenge matching algorithms with multi-factor scoring
|
| 1178 |
+
- Real-time prize information, difficulty levels, and technology requirements
|
| 1179 |
+
- Comprehensive skill analysis and career guidance
|
| 1180 |
+
- Market intelligence and technology trend insights
|
| 1181 |
+
|
| 1182 |
+
CONVERSATION HISTORY:
|
| 1183 |
+
{history_text}
|
| 1184 |
+
|
| 1185 |
+
Guidelines:
|
| 1186 |
+
- Use the REAL challenge data provided above in your responses
|
| 1187 |
+
- Reference actual challenge titles, prizes, and technologies when relevant
|
| 1188 |
+
- Provide specific, actionable advice based on real data
|
| 1189 |
+
- Mention that your data comes from live MCP integration with Topcoder
|
| 1190 |
+
- Be enthusiastic about the real-time data capabilities
|
| 1191 |
+
- If asked about specific technologies, reference actual challenges that use them
|
| 1192 |
+
- For skill questions, suggest real challenges that match their level
|
| 1193 |
+
|
| 1194 |
+
User's current question: {user_message}
|
| 1195 |
+
|
| 1196 |
+
Provide a helpful, intelligent response using the real challenge data context."""
|
| 1197 |
+
|
| 1198 |
+
try:
|
| 1199 |
+
# FIXED: Use proper Python httpx syntax instead of JavaScript fetch
|
| 1200 |
+
async with httpx.AsyncClient(timeout=30.0) as client:
|
| 1201 |
+
response = await client.post(
|
| 1202 |
+
"https://api.anthropic.com/v1/messages",
|
| 1203 |
+
headers={
|
| 1204 |
+
"Content-Type": "application/json",
|
| 1205 |
+
},
|
| 1206 |
+
json={ # Use json parameter instead of body with JSON.stringify
|
| 1207 |
+
"model": "claude-sonnet-4-20250514",
|
| 1208 |
+
"max_tokens": 1000,
|
| 1209 |
+
"messages": [
|
| 1210 |
+
{"role": "user", "content": system_prompt}
|
| 1211 |
+
]
|
| 1212 |
+
}
|
| 1213 |
+
)
|
| 1214 |
+
|
| 1215 |
+
if response.status_code == 200:
|
| 1216 |
+
data = response.json()
|
| 1217 |
+
llm_response = data["content"][0]["text"]
|
| 1218 |
+
|
| 1219 |
+
# Add real-time data indicators
|
| 1220 |
+
llm_response += f"\n\n*🔥 Response powered by real MCP data • {len(challenge_context)} characters of live challenge context*"
|
| 1221 |
+
|
| 1222 |
+
return llm_response
|
| 1223 |
+
else:
|
| 1224 |
+
return await self.get_fallback_response_with_context(user_message, challenge_context)
|
| 1225 |
+
|
| 1226 |
+
except Exception as e:
|
| 1227 |
+
print(f"LLM API error: {e}")
|
| 1228 |
+
return await self.get_fallback_response_with_context(user_message, challenge_context)
|
| 1229 |
+
|
| 1230 |
+
def chat_with_enhanced_llm_agent_sync(message: str, history: List[Tuple[str, str]]) -> Tuple[List[Tuple[str, str]], str]:
|
| 1231 |
+
"""Synchronous wrapper for Gradio"""
|
| 1232 |
+
return asyncio.run(chat_with_enhanced_llm_agent(message, history, intelligence_engine))
|
| 1233 |
+
|
| 1234 |
+
|
| 1235 |
|
| 1236 |
def run_ultimate_performance_test():
|
| 1237 |
"""ULTIMATE comprehensive system performance test"""
|
|
|
|
| 1493 |
)
|
| 1494 |
|
| 1495 |
# Tab 2: ULTIMATE Chat Assistant
|
| 1496 |
+
# with gr.TabItem("💬 ULTIMATE AI Assistant"):
|
| 1497 |
+
# gr.Markdown("""
|
| 1498 |
+
# ### 🤖 Chat with Your ULTIMATE Intelligence Assistant
|
| 1499 |
|
| 1500 |
+
# **🔥 Enhanced with Real MCP Knowledge!** Ask me anything about Topcoder challenges, the 4,596+ real challenges in my database, skill development, market trends, or career growth. I have access to live challenge data and advanced market intelligence!
|
| 1501 |
+
# """)
|
| 1502 |
+
|
| 1503 |
+
# ultimate_chatbot = gr.Chatbot(
|
| 1504 |
+
# label="🚀 ULTIMATE Topcoder Intelligence Assistant",
|
| 1505 |
+
# height=500,
|
| 1506 |
+
# placeholder="Hi! I'm your ULTIMATE assistant with REAL MCP access to 4,596+ challenges. Ask me anything!",
|
| 1507 |
+
# show_label=True
|
| 1508 |
+
# )
|
| 1509 |
+
|
| 1510 |
+
# with gr.Row():
|
| 1511 |
+
# ultimate_chat_input = gr.Textbox(
|
| 1512 |
+
# placeholder="Try: 'hello', 'show me real Python challenges', 'what's the MCP integration?', 'test your systems'",
|
| 1513 |
+
# container=False,
|
| 1514 |
+
# scale=4,
|
| 1515 |
+
# show_label=False
|
| 1516 |
+
# )
|
| 1517 |
+
# ultimate_chat_btn = gr.Button("Send", variant="primary", scale=1)
|
| 1518 |
+
|
| 1519 |
+
# # ULTIMATE chat examples
|
| 1520 |
+
# gr.Examples(
|
| 1521 |
+
# examples=[
|
| 1522 |
+
# "Hello! What makes you ULTIMATE?",
|
| 1523 |
+
# "Tell me about your real MCP integration",
|
| 1524 |
+
# "Show me high-value blockchain challenges",
|
| 1525 |
+
# "What Python challenges have the biggest prizes?",
|
| 1526 |
+
# "I'm advanced - what challenges pay $5000+?",
|
| 1527 |
+
# "Test your ULTIMATE systems"
|
| 1528 |
+
# ],
|
| 1529 |
+
# inputs=ultimate_chat_input
|
| 1530 |
+
# )
|
| 1531 |
|
| 1532 |
+
# # Connect ULTIMATE chat functionality
|
| 1533 |
+
# ultimate_chat_btn.click(
|
| 1534 |
+
# chat_with_ultimate_agent,
|
| 1535 |
+
# inputs=[ultimate_chat_input, ultimate_chatbot],
|
| 1536 |
+
# outputs=[ultimate_chatbot, ultimate_chat_input]
|
| 1537 |
+
# )
|
| 1538 |
+
|
| 1539 |
+
# ultimate_chat_input.submit(
|
| 1540 |
+
# chat_with_ultimate_agent,
|
| 1541 |
+
# inputs=[ultimate_chat_input, ultimate_chatbot],
|
| 1542 |
+
# outputs=[ultimate_chatbot, ultimate_chat_input]
|
| 1543 |
+
# )
|
| 1544 |
+
|
| 1545 |
+
# Update your Gradio interface - Replace the chat section with:
|
| 1546 |
+
|
| 1547 |
+
# UPDATED Chat Tab for your existing interface:
|
| 1548 |
+
|
| 1549 |
+
with gr.TabItem("💬 INTELLIGENT AI Assistant"):
|
| 1550 |
+
gr.Markdown('''
|
| 1551 |
+
### 🧠 Chat with Your INTELLIGENT AI Assistant
|
| 1552 |
+
|
| 1553 |
+
**🔥 Enhanced with Real LLM + Live MCP Data!**
|
| 1554 |
+
|
| 1555 |
+
Ask me anything and I'll use:
|
| 1556 |
+
- 🤖 **Advanced LLM Intelligence** for natural conversations
|
| 1557 |
+
- 🔥 **Real MCP Data** from 4,596+ live Topcoder challenges
|
| 1558 |
+
- 📊 **Live Challenge Analysis** with current prizes and requirements
|
| 1559 |
+
- 🎯 **Personalized Recommendations** based on your interests
|
| 1560 |
+
|
| 1561 |
+
Try asking: "Show me Python challenges with high prizes" or "What React opportunities are available?"
|
| 1562 |
+
''')
|
| 1563 |
+
|
| 1564 |
+
enhanced_chatbot = gr.Chatbot(
|
| 1565 |
+
label="🧠 INTELLIGENT Topcoder AI Assistant",
|
| 1566 |
height=500,
|
| 1567 |
+
placeholder="Hi! I'm your intelligent assistant with real LLM and live MCP data access to 4,596+ challenges!",
|
| 1568 |
show_label=True
|
| 1569 |
)
|
| 1570 |
|
| 1571 |
with gr.Row():
|
| 1572 |
+
enhanced_chat_input = gr.Textbox(
|
| 1573 |
+
placeholder="Ask me about challenges, skills, career advice, or anything else!",
|
| 1574 |
container=False,
|
| 1575 |
scale=4,
|
| 1576 |
show_label=False
|
| 1577 |
)
|
| 1578 |
+
enhanced_chat_btn = gr.Button("Send", variant="primary", scale=1)
|
| 1579 |
|
| 1580 |
+
# Enhanced examples
|
| 1581 |
gr.Examples(
|
| 1582 |
examples=[
|
| 1583 |
+
"What Python challenges offer the highest prizes?",
|
| 1584 |
+
"Show me beginner-friendly React opportunities",
|
| 1585 |
+
"Which blockchain challenges are most active?",
|
| 1586 |
+
"What skills are in highest demand right now?",
|
| 1587 |
+
"Help me choose between machine learning and web development",
|
| 1588 |
+
"What's the average prize for intermediate challenges?"
|
| 1589 |
],
|
| 1590 |
+
inputs=enhanced_chat_input
|
| 1591 |
)
|
| 1592 |
|
| 1593 |
+
# Connect enhanced LLM functionality
|
| 1594 |
+
enhanced_chat_btn.click(
|
| 1595 |
+
chat_with_enhanced_llm_agent_sync,
|
| 1596 |
+
inputs=[enhanced_chat_input, enhanced_chatbot],
|
| 1597 |
+
outputs=[enhanced_chatbot, enhanced_chat_input]
|
| 1598 |
)
|
| 1599 |
|
| 1600 |
+
enhanced_chat_input.submit(
|
| 1601 |
+
chat_with_enhanced_llm_agent_sync,
|
| 1602 |
+
inputs=[enhanced_chat_input, enhanced_chatbot],
|
| 1603 |
+
outputs=[enhanced_chatbot, enhanced_chat_input]
|
| 1604 |
)
|
| 1605 |
|
| 1606 |
+
|
| 1607 |
# Tab 3: ULTIMATE Performance & Technical Details
|
| 1608 |
with gr.TabItem("⚡ ULTIMATE Performance"):
|
| 1609 |
gr.Markdown("""
|
requirements.txt
CHANGED
|
@@ -1,23 +1,22 @@
|
|
| 1 |
-
# # Updated Windows-compatible requirements for Topcoder Intelligence Assistant
|
| 2 |
-
# # Working configuration with Gradio 5.39.0
|
| 3 |
-
|
| 4 |
-
# # UI Framework - confirmed working version
|
| 5 |
-
# gradio==5.39.0
|
| 6 |
-
|
| 7 |
-
# # Core dependencies (pre-built wheels available)
|
| 8 |
-
# httpx>=0.25.0
|
| 9 |
-
# python-dotenv>=1.0.0
|
| 10 |
-
# typing-extensions>=4.8.0
|
| 11 |
-
|
| 12 |
-
# # Optional: For future MCP integration when authentication is resolved
|
| 13 |
-
# # fastapi>=0.104.0
|
| 14 |
-
# # uvicorn>=0.24.0
|
| 15 |
-
|
| 16 |
-
# Hugging Face Spaces Deployment Requirements
|
| 17 |
# Topcoder Challenge Intelligence Assistant
|
| 18 |
-
#
|
| 19 |
-
|
| 20 |
gradio==5.39.0
|
|
|
|
| 21 |
httpx>=0.25.0
|
|
|
|
|
|
|
|
|
|
| 22 |
python-dotenv>=1.0.0
|
| 23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# Topcoder Challenge Intelligence Assistant
|
| 2 |
+
# Windows Compatible Requirements - Updated with OpenAI LLM Integration
|
| 3 |
+
# Core Framework for UI
|
| 4 |
gradio==5.39.0
|
| 5 |
+
# HTTP Client for MCP Integration
|
| 6 |
httpx>=0.25.0
|
| 7 |
+
# OpenAI API for Intelligent Chat
|
| 8 |
+
openai>=1.0.0
|
| 9 |
+
# Environment and Configuration
|
| 10 |
python-dotenv>=1.0.0
|
| 11 |
+
# Type Hints
|
| 12 |
+
typing-extensions>=4.8.0
|
| 13 |
+
# Image Processing for Gradio
|
| 14 |
+
pillow>=10.1.0
|
| 15 |
+
# Optional: Enhanced functionality
|
| 16 |
+
markdown>=3.5.1
|
| 17 |
+
numpy>=1.24.3
|
| 18 |
+
# Development and Testing
|
| 19 |
+
pytest>=7.4.3
|
| 20 |
+
# Note: All packages chosen for Windows compatibility
|
| 21 |
+
# No compilation required, works on Hugging Face CPU Basic
|
| 22 |
+
# OpenAI package added for intelligent LLM chat integration
|