IJ-Reynolds HF Staff commited on
Commit
37103dc
·
verified ·
1 Parent(s): f2ab35e

Update streamlit_app.py

Browse files
Files changed (1) hide show
  1. streamlit_app.py +7 -3
streamlit_app.py CHANGED
@@ -172,8 +172,10 @@ if active_df is not None and not active_df.empty:
172
  with st.spinner("AI is synthesizing latest data..."):
173
  top_items = active_df.head(10)
174
  context = "\n".join([f"- {row['title']} (Source: {row['source']})" for _, row in top_items.iterrows()])
 
 
175
  messages = [
176
- {"role": "system", "content": "You are a senior D.C. policy advisor. Summarize data into 3 actionable bullets, citing sources heavily."},
177
  {"role": "user", "content": f"Summarize these updates:\n\n{context}"}
178
  ]
179
  try:
@@ -214,12 +216,13 @@ def render_event_cards(display_df):
214
  card_type = row['type']
215
  icon = type_icons.get(card_type, "⚪")
216
  color = color_map.get(card_type, "gray")
 
217
 
218
  raw_title = str(row['title'])
219
  display_title = raw_title[:75] + ("..." if len(raw_title) > 75 else "")
220
 
221
- # Injecting the emoji icon right into the dropdown header
222
- with st.expander(f"{icon} {dt_str} | {card_type} | {display_title}"):
223
  col1, col2 = st.columns([3, 1])
224
  with col1:
225
  st.markdown("### Executive Summary")
@@ -228,6 +231,7 @@ def render_event_cards(display_df):
228
  with col2:
229
  st.markdown("### Metadata")
230
  st.markdown(f"**Category:** :{color}[{card_type}]")
 
231
  st.write(f"**Action:** {row['latest_action']}")
232
  st.link_button("View Source", str(row['link']), use_container_width=True)
233
 
 
172
  with st.spinner("AI is synthesizing latest data..."):
173
  top_items = active_df.head(10)
174
  context = "\n".join([f"- {row['title']} (Source: {row['source']})" for _, row in top_items.iterrows()])
175
+
176
+ # AI Prompt
177
  messages = [
178
+ {"role": "system", "content": "Summarize the following data into 3 concise, bullets, citing sources inline. Do not include facts/information not aligned with the original data"},
179
  {"role": "user", "content": f"Summarize these updates:\n\n{context}"}
180
  ]
181
  try:
 
216
  card_type = row['type']
217
  icon = type_icons.get(card_type, "⚪")
218
  color = color_map.get(card_type, "gray")
219
+ source = row.get('source', 'Unknown Source')
220
 
221
  raw_title = str(row['title'])
222
  display_title = raw_title[:75] + ("..." if len(raw_title) > 75 else "")
223
 
224
+ # UPDATED: Injected {source} directly into the UI header
225
+ with st.expander(f"{icon} {dt_str} | {card_type} | {source} | {display_title}"):
226
  col1, col2 = st.columns([3, 1])
227
  with col1:
228
  st.markdown("### Executive Summary")
 
231
  with col2:
232
  st.markdown("### Metadata")
233
  st.markdown(f"**Category:** :{color}[{card_type}]")
234
+ st.write(f"**Source:** {source}")
235
  st.write(f"**Action:** {row['latest_action']}")
236
  st.link_button("View Source", str(row['link']), use_container_width=True)
237