Upload app.py
Browse files
app.py
CHANGED
|
@@ -963,7 +963,8 @@ async def get_ultimate_recommendations_async(
|
|
| 963 |
status: str, prize_min: int, prize_max: int, challenge_type: str, track: str,
|
| 964 |
sort_by: str, sort_order: str
|
| 965 |
) -> Tuple[str, str]:
|
| 966 |
-
|
|
|
|
| 967 |
skills = [skill.strip() for skill in skills_input.split(',') if skill.strip()]
|
| 968 |
user_profile = UserProfile(
|
| 969 |
skills=skills,
|
|
@@ -987,23 +988,10 @@ async def get_ultimate_recommendations_async(
|
|
| 987 |
insights = intelligence_engine.get_user_insights(user_profile)
|
| 988 |
recommendations = recommendations_data["recommendations"]
|
| 989 |
insights_data = recommendations_data["insights"]
|
| 990 |
-
|
| 991 |
-
user_profile=user_profile,
|
| 992 |
-
query=interests,
|
| 993 |
-
limit=50,
|
| 994 |
-
status=status,
|
| 995 |
-
prize_min=prize_min,
|
| 996 |
-
prize_max=prize_max,
|
| 997 |
-
challenge_type=challenge_type,
|
| 998 |
-
track=track,
|
| 999 |
-
sort_by=sort_by,
|
| 1000 |
-
sort_order=sort_order,
|
| 1001 |
-
)
|
| 1002 |
# Format results with enhanced styling
|
| 1003 |
if recommendations:
|
| 1004 |
-
# Success header with data source info
|
| 1005 |
data_source_emoji = "🔥" if "REAL" in insights_data['data_source'] else "⚡"
|
| 1006 |
-
|
| 1007 |
recommendations_html = f"""
|
| 1008 |
<div style='background:linear-gradient(135deg,#00b894,#00a085);color:white;padding:20px;border-radius:12px;margin-bottom:25px;text-align:center;box-shadow:0 8px 25px rgba(0,184,148,0.3);'>
|
| 1009 |
<div style='font-size:2.5em;margin-bottom:10px;'>{data_source_emoji}</div>
|
|
@@ -1012,11 +1000,8 @@ async def get_ultimate_recommendations_async(
|
|
| 1012 |
<div style='opacity:0.9;font-size:0.9em;margin-top:5px;'>Source: {insights_data['data_source']}</div>
|
| 1013 |
</div>
|
| 1014 |
"""
|
| 1015 |
-
|
| 1016 |
-
# Add formatted challenge cards
|
| 1017 |
for challenge in recommendations:
|
| 1018 |
recommendations_html += format_challenge_card(challenge)
|
| 1019 |
-
|
| 1020 |
else:
|
| 1021 |
recommendations_html = """
|
| 1022 |
<div style='background:linear-gradient(135deg,#fdcb6e,#e17055);color:white;padding:25px;border-radius:12px;text-align:center;box-shadow:0 8px 25px rgba(253,203,110,0.3);'>
|
|
@@ -1025,16 +1010,13 @@ async def get_ultimate_recommendations_async(
|
|
| 1025 |
<div style='opacity:0.9;font-size:1em;'>Try adjusting your skills, experience level, or interests for better results</div>
|
| 1026 |
</div>
|
| 1027 |
"""
|
| 1028 |
-
|
| 1029 |
# Generate insights panel
|
| 1030 |
insights_html = format_insights_panel(insights)
|
| 1031 |
-
|
| 1032 |
processing_time = round(time.time() - start_time, 3)
|
| 1033 |
print(f"✅ ULTIMATE request completed successfully in {processing_time}s")
|
| 1034 |
print(f"📊 Returned {len(recommendations)} recommendations with comprehensive insights\n")
|
| 1035 |
-
|
| 1036 |
return recommendations_html, insights_html
|
| 1037 |
-
|
| 1038 |
except Exception as e:
|
| 1039 |
error_msg = f"""
|
| 1040 |
<div style='background:linear-gradient(135deg,#e17055,#d63031);color:white;padding:25px;border-radius:12px;text-align:center;box-shadow:0 8px 25px rgba(225,112,85,0.3);'>
|
|
|
|
| 963 |
status: str, prize_min: int, prize_max: int, challenge_type: str, track: str,
|
| 964 |
sort_by: str, sort_order: str
|
| 965 |
) -> Tuple[str, str]:
|
| 966 |
+
start_time = time.time()
|
| 967 |
+
try:
|
| 968 |
skills = [skill.strip() for skill in skills_input.split(',') if skill.strip()]
|
| 969 |
user_profile = UserProfile(
|
| 970 |
skills=skills,
|
|
|
|
| 988 |
insights = intelligence_engine.get_user_insights(user_profile)
|
| 989 |
recommendations = recommendations_data["recommendations"]
|
| 990 |
insights_data = recommendations_data["insights"]
|
| 991 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 992 |
# Format results with enhanced styling
|
| 993 |
if recommendations:
|
|
|
|
| 994 |
data_source_emoji = "🔥" if "REAL" in insights_data['data_source'] else "⚡"
|
|
|
|
| 995 |
recommendations_html = f"""
|
| 996 |
<div style='background:linear-gradient(135deg,#00b894,#00a085);color:white;padding:20px;border-radius:12px;margin-bottom:25px;text-align:center;box-shadow:0 8px 25px rgba(0,184,148,0.3);'>
|
| 997 |
<div style='font-size:2.5em;margin-bottom:10px;'>{data_source_emoji}</div>
|
|
|
|
| 1000 |
<div style='opacity:0.9;font-size:0.9em;margin-top:5px;'>Source: {insights_data['data_source']}</div>
|
| 1001 |
</div>
|
| 1002 |
"""
|
|
|
|
|
|
|
| 1003 |
for challenge in recommendations:
|
| 1004 |
recommendations_html += format_challenge_card(challenge)
|
|
|
|
| 1005 |
else:
|
| 1006 |
recommendations_html = """
|
| 1007 |
<div style='background:linear-gradient(135deg,#fdcb6e,#e17055);color:white;padding:25px;border-radius:12px;text-align:center;box-shadow:0 8px 25px rgba(253,203,110,0.3);'>
|
|
|
|
| 1010 |
<div style='opacity:0.9;font-size:1em;'>Try adjusting your skills, experience level, or interests for better results</div>
|
| 1011 |
</div>
|
| 1012 |
"""
|
|
|
|
| 1013 |
# Generate insights panel
|
| 1014 |
insights_html = format_insights_panel(insights)
|
|
|
|
| 1015 |
processing_time = round(time.time() - start_time, 3)
|
| 1016 |
print(f"✅ ULTIMATE request completed successfully in {processing_time}s")
|
| 1017 |
print(f"📊 Returned {len(recommendations)} recommendations with comprehensive insights\n")
|
|
|
|
| 1018 |
return recommendations_html, insights_html
|
| 1019 |
+
|
| 1020 |
except Exception as e:
|
| 1021 |
error_msg = f"""
|
| 1022 |
<div style='background:linear-gradient(135deg,#e17055,#d63031);color:white;padding:25px;border-radius:12px;text-align:center;box-shadow:0 8px 25px rgba(225,112,85,0.3);'>
|