AI_Personas / docs /WEB_UI_VISUAL_GUIDE.md
Claude
Add beautiful web UI for interactive persona conversations
16a929f unverified

A newer version of the Streamlit SDK is available: 1.54.0

Upgrade

Web UI Visual Guide

Interface Layout

╔════════════════════════════════════════════════════════════════════════════╗
β•‘                  πŸ™οΈ AI Personas for Urban Planning                         β•‘
β•‘          Explore diverse stakeholder perspectives on urban planning        β•‘
╠════════════════════════════════════════╦═══════════════════════════════════╣
β•‘                                        β•‘     πŸ‘₯ Select a Persona           β•‘
β•‘  πŸ’¬ Conversation                       β•‘     Click to start conversation   β•‘
β•‘  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β•‘                                   β•‘
β•‘  β”‚ Currently talking with:        β”‚   β•‘   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β•‘
β•‘  β”‚ 🌱 Sarah Chen (Urban Planner)  β”‚   β•‘   β”‚         🌱                β”‚   β•‘
β•‘  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β•‘   β”‚    Sarah Chen            β”‚   β•‘
β•‘                                        β•‘   β”‚   Urban Planner          β”‚   β•‘
β•‘  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β•‘   β”‚Progressive, sustainabilityβ”‚   β•‘
β•‘  β”‚ Your question: ________________β”‚   β•‘   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β•‘
β•‘  β”‚                         [Send] β”‚   β•‘                                   β•‘
β•‘  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β•‘   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β•‘
β•‘                                        β•‘   β”‚         πŸͺ                β”‚   β•‘
β•‘  πŸ’‘ Try asking:                        β•‘   β”‚   Marcus Thompson        β”‚   β•‘
β•‘  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β•‘   β”‚   Business Owner         β”‚   β•‘
β•‘  β”‚ What's most      β”‚ β”‚ Should we   β”‚ β•‘   β”‚ Pragmatic, economy-first β”‚   β•‘
β•‘  β”‚ important issue? β”‚ β”‚ allow food  β”‚ β•‘   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β•‘
β•‘  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β•‘                                   β•‘
β•‘  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β•‘   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β•‘
β•‘  β”‚ How to make city β”‚ β”‚ Affordable  β”‚ β•‘   β”‚         πŸš‡                β”‚   β•‘
β•‘  β”‚ sustainable?     β”‚ β”‚ housing?    β”‚ β•‘   β”‚  Dr. Elena Rodriguez     β”‚   β•‘
β•‘  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β•‘   β”‚Transportation Engineer   β”‚   β•‘
β•‘                                        β•‘   β”‚ Data-driven, safety-firstβ”‚   β•‘
β•‘  ─────────────────────────────────     β•‘   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β•‘
β•‘                                        β•‘                                   β•‘
β•‘  πŸ“œ Conversation History               β•‘   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β•‘
β•‘                                        β•‘   β”‚         🏑                β”‚   β•‘
β•‘  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β•‘   β”‚    James O'Brien         β”‚   β•‘
β•‘  β”‚ πŸ™‹ You:                        β”‚   β•‘   β”‚   Long-time Resident     β”‚   β•‘
β•‘  β”‚ What do you think about the    β”‚   β•‘   β”‚Traditional, community-   β”‚   β•‘
β•‘  β”‚ bike lane proposal?            β”‚   β•‘   β”‚      focused             β”‚   β•‘
β•‘  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β•‘   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β•‘
β•‘                                        β•‘                                   β•‘
β•‘  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β•‘   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β•‘
β•‘  β”‚ 🌱 Sarah Chen:                 β”‚   β•‘   β”‚         ✊                β”‚   β•‘
β•‘  β”‚ I strongly support this bike   β”‚   β•‘   β”‚     Priya Patel          β”‚   β•‘
β•‘  β”‚ lane proposal. As an urban     β”‚   β•‘   β”‚   Housing Advocate       β”‚   β•‘
β•‘  β”‚ planner focused on             β”‚   β•‘   β”‚ Activist, equity-focused β”‚   β•‘
β•‘  β”‚ sustainability, I believe this β”‚   β•‘   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β•‘
β•‘  β”‚ aligns perfectly with our      β”‚   β•‘                                   β•‘
β•‘  β”‚ climate goals. The data shows  β”‚   β•‘   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β•‘
β•‘  β”‚ protected bike lanes reduce... β”‚   β•‘   β”‚         🏒                β”‚   β•‘
β•‘  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β•‘   β”‚      David Kim           β”‚   β•‘
β•‘                                        β•‘   β”‚ Real Estate Developer    β”‚   β•‘
β•‘  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β•‘   β”‚Market-driven, growth-    β”‚   β•‘
β•‘  β”‚ πŸ—‘οΈ Clear Conversation          β”‚   β•‘   β”‚      oriented            β”‚   β•‘
β•‘  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β•‘   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β•‘
β•‘                                        β•‘                                   β•‘
╠════════════════════════════════════════╩═══════════════════════════════════╣
β•‘  AI Personas β€’ Phase 1 β€’ Powered by Claude 3 Haiku β€’ View Code            β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

Key Features Illustrated

1. Persona Cards (Right Panel)

Each persona card shows:

  • Avatar emoji - Visual identifier (🌱 πŸͺ πŸš‡ 🏑 ✊ 🏒)
  • Name - Full name of the persona
  • Role - Their professional or community role
  • Tagline - Brief description of their perspective

Selected State:

  • Cards highlight when selected (blue border)
  • Button turns to "primary" style
  • Name appears in conversation header

2. Conversation Area (Left Panel - Top)

Currently Talking With Banner:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Currently talking with:        β”‚
β”‚ 🌱 Sarah Chen (Urban Planner)  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Shows who you're conversing with.

Question Input:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Your question: [Type here...] β”‚
β”‚                        [Send]  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
  • Text input field for questions
  • Placeholder text guides the user
  • Send button to submit

3. Quick Suggestions (Left Panel - Middle)

πŸ’‘ Try asking:
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ What's most      β”‚ β”‚ Should we   β”‚
β”‚ important issue? β”‚ β”‚ allow food  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Four pre-written questions to get started:

  • Click any button to auto-fill the question
  • Helpful for first-time users
  • Demonstrates good question types

4. Conversation History (Left Panel - Bottom)

User Messages (Blue):

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ πŸ™‹ You:                        β”‚
β”‚ What do you think about the    β”‚
β”‚ bike lane proposal?            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Persona Responses (Gray):

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 🌱 Sarah Chen:                 β”‚
β”‚ I strongly support this bike   β”‚
β”‚ lane proposal...               β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Clear Button:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ πŸ—‘οΈ Clear Conversation          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Resets the conversation for a fresh start.

User Flow

First Visit

1. User lands on page
   ↓
2. Sees 6 persona cards on right
   ↓
3. Sees "Select a persona" message on left
   ↓
4. Clicks on a persona (e.g., Sarah Chen)
   ↓
5. Persona card highlights
   ↓
6. Left panel shows "Currently talking with Sarah Chen"
   ↓
7. User sees quick suggestions
   ↓
8. Clicks suggestion or types question
   ↓
9. Clicks Send button
   ↓
10. "πŸ’­ Sarah Chen is thinking..." appears
    ↓
11. Response appears in conversation history
    ↓
12. User can ask follow-up or switch persona

Switching Personas

1. User clicks different persona (e.g., Marcus)
   ↓
2. Previous persona card unhighlights
   ↓
3. New persona card highlights
   ↓
4. Conversation history clears
   ↓
5. Banner updates to show Marcus Thompson
   ↓
6. User can start new conversation

Color Coding

Each persona has a unique color theme:

  • 🌱 Sarah Chen: Green (#4CAF50) - Sustainability
  • πŸͺ Marcus Thompson: Orange (#FF9800) - Business/Commerce
  • πŸš‡ Elena Rodriguez: Blue (#2196F3) - Technical/Engineering
  • 🏑 James O'Brien: Brown (#795548) - Traditional/Established
  • ✊ Priya Patel: Pink (#E91E63) - Activism/Energy
  • 🏒 David Kim: Gray (#607D8B) - Professional/Corporate

Responsive Design

Desktop (Wide Screen)

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                         β”‚  Personas β”‚
β”‚    Conversation         β”‚   Cards   β”‚
β”‚      (2/3 width)        β”‚ (1/3 width)β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Tablet (Medium Screen)

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”
β”‚                         β”‚ P   β”‚
β”‚    Conversation         β”‚ e   β”‚
β”‚                         β”‚ r   β”‚
β”‚                         β”‚ s   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”˜

Mobile (Narrow Screen)

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Conversation  β”‚
β”‚               β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Persona Cards β”‚
β”‚ (Stacked)     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Interactive Elements

Buttons

Persona Selection Buttons:

  • Hover: Slight lift effect (translateY)
  • Selected: Primary color, bold border
  • Unselected: Secondary color, subtle border

Send Button:

  • Full width of container
  • Primary color
  • Bold text
  • 3rem height for easy clicking

Suggestion Buttons:

  • Two columns layout
  • Full width of container
  • Secondary color
  • Fills input when clicked

Clear Conversation:

  • Full width
  • Warning/destructive action style
  • Icon + text label

Input Field

Text Input:

  • Placeholder: "e.g., What do you think about..."
  • Auto-focus when page loads
  • Enter key submits
  • Clears after sending

Loading States

Thinking Indicator:

πŸ’­ Sarah Chen is thinking...

Shows while waiting for API response.

System Initialization:

πŸ”§ Initializing AI Personas system...

Shows on first page load.

Accessibility Features

  • Keyboard Navigation: Tab through all interactive elements
  • Screen Reader Support: Semantic HTML with ARIA labels
  • High Contrast: Text meets WCAG AA standards
  • Focus Indicators: Visible keyboard focus states
  • Clear Labels: All buttons have descriptive text

Tips for Best Experience

1. Large Screen Recommended

  • Best viewed on desktop or tablet (β‰₯1024px width)
  • Mobile works but cards may stack vertically

2. Modern Browser

  • Chrome, Firefox, Safari, Edge (recent versions)
  • JavaScript must be enabled

3. Stable Internet

  • Responses require API calls
  • 2-5 seconds per response

4. Clear Conversation

  • Click "Clear Conversation" before switching topics
  • Or switch personas for fresh start

Comparison: CLI vs. Web UI

Feature CLI (src.cli) Web UI (web_app.py)
Visual Text-only Rich visual interface
Personas Text list Emoji avatars + cards
History Scrolling text Formatted chat boxes
Input Command prompt Text field with Send button
Suggestions None Quick-click buttons
Selection Type persona ID Click card
Mobile Terminal only Web browser
Learning curve Higher Lower
Power user Better for scripts Better for exploration

Future Enhancements

Planned improvements:

  • Export conversation to PDF
  • Dark mode toggle
  • Voice input/output
  • Multi-persona comparison (split view)
  • Conversation templates
  • Mobile app version
  • Real-time typing indicators
  • Emoji reactions to responses
  • Save/load conversations
  • Share conversation links

The Web UI makes exploring personas intuitive, visual, and engaging! 🎨