Spaces:
Runtime error
Runtime error
Create config/agent_config.py
Browse files- config/agent_config.py +83 -0
config/agent_config.py
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# config/agent_config.py
|
| 2 |
+
|
| 3 |
+
AGENT_PERSONAS = {
|
| 4 |
+
'Collection Agent': {
|
| 5 |
+
'emoji': '🔍',
|
| 6 |
+
'activities': [
|
| 7 |
+
'Scanning social platforms...',
|
| 8 |
+
'Collecting trending posts...',
|
| 9 |
+
'Processing engagement metrics...',
|
| 10 |
+
'Analyzing hashtag patterns...',
|
| 11 |
+
'Gathering location data...',
|
| 12 |
+
'Validating trend sources...'
|
| 13 |
+
]
|
| 14 |
+
},
|
| 15 |
+
'Research Agent': {
|
| 16 |
+
'emoji': '📊',
|
| 17 |
+
'activities': [
|
| 18 |
+
'Analyzing trend context...',
|
| 19 |
+
'Evaluating engagement patterns...',
|
| 20 |
+
'Processing geographic data...',
|
| 21 |
+
'Calculating growth metrics...',
|
| 22 |
+
'Generating predictions...'
|
| 23 |
+
]
|
| 24 |
+
},
|
| 25 |
+
'Analysis Agent': {
|
| 26 |
+
'emoji': '🧪',
|
| 27 |
+
'activities': [
|
| 28 |
+
'Calculating trend scores...',
|
| 29 |
+
'Mapping geographic spread...',
|
| 30 |
+
'Generating visualizations...',
|
| 31 |
+
'Processing demographics...',
|
| 32 |
+
'Creating forecasts...'
|
| 33 |
+
]
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
def get_agent_status(agent_name: str) -> str:
|
| 38 |
+
"""Get current status for an agent"""
|
| 39 |
+
if agent_name not in AGENT_PERSONAS:
|
| 40 |
+
return "Working..."
|
| 41 |
+
|
| 42 |
+
from datetime import datetime
|
| 43 |
+
import streamlit as st
|
| 44 |
+
|
| 45 |
+
activities = AGENT_PERSONAS[agent_name]['activities']
|
| 46 |
+
current_time = datetime.now()
|
| 47 |
+
start_time = st.session_state.get('start_time', current_time)
|
| 48 |
+
index = int((current_time - start_time).total_seconds() / 2) % len(activities)
|
| 49 |
+
|
| 50 |
+
return activities[index]
|
| 51 |
+
|
| 52 |
+
def display_agent_progress():
|
| 53 |
+
"""Display agent progress with visual enhancements"""
|
| 54 |
+
import streamlit as st
|
| 55 |
+
|
| 56 |
+
st.markdown("### 🤖 Analysis Team Progress")
|
| 57 |
+
|
| 58 |
+
for agent_name, persona in AGENT_PERSONAS.items():
|
| 59 |
+
emoji = persona['emoji']
|
| 60 |
+
|
| 61 |
+
if agent_name in st.session_state.completed_agents:
|
| 62 |
+
status = "✅ Completed"
|
| 63 |
+
color = "green"
|
| 64 |
+
elif agent_name == st.session_state.current_agent:
|
| 65 |
+
status = get_agent_status(agent_name)
|
| 66 |
+
color = "blue"
|
| 67 |
+
else:
|
| 68 |
+
status = "Waiting..."
|
| 69 |
+
color = "gray"
|
| 70 |
+
|
| 71 |
+
st.markdown(f"""
|
| 72 |
+
<div style='padding: 10px; margin: 5px; border-radius: 5px; border: 1px solid {color}'>
|
| 73 |
+
<div style='font-weight: bold; color: {color}'>{emoji} {agent_name}</div>
|
| 74 |
+
<div style='color: {color}; font-size: 0.9em'>{status}</div>
|
| 75 |
+
</div>
|
| 76 |
+
""", unsafe_allow_html=True)
|
| 77 |
+
|
| 78 |
+
completed = len(st.session_state.completed_agents)
|
| 79 |
+
total = len(AGENT_PERSONAS)
|
| 80 |
+
progress = completed / total
|
| 81 |
+
|
| 82 |
+
st.progress(progress)
|
| 83 |
+
st.markdown(f"**Overall Progress:** {progress * 100:.0f}%")
|