-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdemo_visual_resources.py
More file actions
174 lines (154 loc) · 5.65 KB
/
demo_visual_resources.py
File metadata and controls
174 lines (154 loc) · 5.65 KB
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#!/usr/bin/env python3
"""
Demo script to showcase visual resources in Strava Agent
This script demonstrates how the agent displays maps, profile photos, and club logos
"""
import os
from dotenv import load_dotenv
# Load environment variables
load_dotenv()
def demo_visual_resources():
"""Display examples of visual resources available in Strava Agent"""
print("=" * 80)
print("🎨 STRAVA AGENT - VISUAL RESOURCES DEMO")
print("=" * 80)
print()
# Check if Google Maps API key is configured
google_maps_key = os.getenv("GOOGLE_MAPS_API_KEY")
if google_maps_key:
print("✅ Google Maps API Key: Configured")
else:
print("❌ Google Maps API Key: NOT configured")
print(" → Set GOOGLE_MAPS_API_KEY in .env file")
print()
print("-" * 80)
print("📊 AVAILABLE VISUAL RESOURCES")
print("-" * 80)
print()
# 1. Route Maps
print("1️⃣ ROUTE MAPS 🗺️")
print(" Description: Static maps showing activity routes")
print(" Source: Google Maps Static API + Strava polylines")
print(" Format: ")
print(" Size: 600x400 pixels")
print(" Example query: 'Muéstrame mi última actividad con el mapa'")
print()
# Example polyline (encoded GPS data)
example_polyline = "_p~iF~ps|U_ulLnnqC_mqNvxq`@"
if google_maps_key:
example_map_url = f"https://maps.googleapis.com/maps/api/staticmap?size=600x400&path=enc:{example_polyline}&key={google_maps_key}"
print(f" Example URL: {example_map_url[:80]}...")
print()
# 2. Profile Photos
print("2️⃣ PROFILE PHOTOS 👤")
print(" Description: Athlete profile pictures from Strava")
print(" Source: Strava CDN (dgalywyr863hv.cloudfront.net)")
print(" Format: ")
print(" Example query: 'Muéstrame mi perfil de Strava'")
print()
# 3. Club Logos
print("3️⃣ CLUB LOGOS 🏆")
print(" Description: Logos of clubs the athlete belongs to")
print(" Source: Strava CDN (dgalywyr863hv.cloudfront.net)")
print(" Format: ")
print(" Example query: '¿A qué clubes pertenezco?'")
print()
print("-" * 80)
print("💡 HOW IT WORKS")
print("-" * 80)
print()
print("1. User asks a question (e.g., 'Show my last activity')")
print("2. Agent calls Strava API to get activity data")
print("3. Agent extracts polyline (GPS data) from activity")
print("4. Agent generates Google Maps URL with polyline")
print("5. Agent formats response with Markdown image syntax")
print("6. AgentStack UI renders the image automatically")
print()
print("-" * 80)
print("📝 EXAMPLE RESPONSES")
print("-" * 80)
print()
# Example 1: Activity with map
print("Example 1: Activity with Route Map")
print("-" * 40)
print("User: 'Muéstrame mi actividad más reciente'")
print()
print("Agent Response:")
print("```markdown")
print("🏃 **Morning Run**")
print("📅 Date: 2024-01-15")
print("⏱️ Duration: 45:23")
print("📏 Distance: 8.5 km")
print("⚡ Average Speed: 11.2 km/h")
print()
print("")
print("```")
print()
# Example 2: Profile with photo
print("Example 2: Profile with Photo")
print("-" * 40)
print("User: 'Muéstrame mi perfil completo'")
print()
print("Agent Response:")
print("```markdown")
print("👤 **John Doe**")
print()
print("")
print()
print("📍 Location: San Francisco, CA")
print("🏃 Activities: 156")
print("👥 Followers: 234")
print("```")
print()
# Example 3: Clubs with logos
print("Example 3: Clubs with Logos")
print("-" * 40)
print("User: '¿A qué clubes pertenezco?'")
print()
print("Agent Response:")
print("```markdown")
print("🏆 **Your Clubs:**")
print()
print("1. **Running Club SF**")
print(" ")
print(" 👥 Members: 450")
print()
print("2. **Bay Area Cyclists**")
print(" ")
print(" 👥 Members: 320")
print("```")
print()
print("-" * 80)
print("⚠️ LIMITATIONS")
print("-" * 80)
print()
print("• Indoor activities (treadmill, stationary bike) have NO maps")
print(" → They don't have GPS data (empty polyline)")
print()
print("• Google Maps Static API has usage limits")
print(" → Free tier: 25,000 map loads per day")
print()
print("• Strava API has rate limits")
print(" → 100 requests per 15 minutes")
print(" → 1,000 requests per day")
print()
print("-" * 80)
print("🚀 NEXT STEPS")
print("-" * 80)
print()
print("1. Open the AgentStack UI: http://localhost:8333")
print("2. Select 'Strava Agent' from the menu")
print("3. Try these queries:")
print(" • 'Muéstrame mi última actividad'")
print(" • 'Muéstrame mi perfil'")
print(" • '¿A qué clubes pertenezco?'")
print()
print("4. See the images render automatically in the UI!")
print()
print("=" * 80)
print("📚 For more information, see: VISUAL_RESOURCES_DEMO.md")
print("=" * 80)
print()
if __name__ == "__main__":
demo_visual_resources()
# Made with Bob