Spaces:
Configuration error
Configuration error
File size: 5,588 Bytes
33a15a9 | 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 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | # User-Friendly Interface Guide
## Overview
The new user interface provides a simplified, intuitive way to interact with the Zynd Civic Assistant system through 4 main options:
1. **π° Check Benefits** - Discover all government benefits you qualify for
2. **β
Verify Eligibility** - Check if you qualify for a specific scheme
3. **π Explain Policy** - Understand any government policy in simple terms
4. **π Help Fill Application** - Get step-by-step guidance to apply
## Running the Interface
### Quick Start
```powershell
# From the project root
streamlit run src/user_interface.py
```
The interface will open in your browser at `http://localhost:8501`
### Using the Old Interface (CLI or Original Streamlit)
```powershell
# Command-line interface
python src/main.py
# Original chat-based Streamlit
streamlit run src/streamlit_app.py
```
## How It Works
### 1. Select an Option
On the home page, click one of the 4 main option buttons based on what you need.
### 2. Answer Questions
Each option will present relevant questions:
- **Check Benefits** asks about: age, income, location, employment, family size, education, category
- **Verify Eligibility** asks about: scheme name + your profile information
- **Explain Policy** asks: which policy and what aspect to explain
- **Help Application** asks: scheme name, documents available, application stage
All questions include:
- Clear labels and descriptions
- Help text explaining why the question matters
- Input validation with helpful error messages
- Required vs optional field indicators
### 3. Get Results
After submitting, the system:
1. Validates your inputs
2. Builds a comprehensive query from your answers
3. Routes to the appropriate agent(s)
4. Displays personalized, actionable results
### 4. Custom Queries
Don't fit into one of the 4 options? Use the free-form text box at the bottom of the home page to ask anything directly.
## Features
### Input Validation
- **Age**: Must be 0-120
- **Income**: Positive numbers, formatted correctly
- **Location**: Valid state/region names
- **Scheme/Policy**: Minimum 3 characters
- **Family Size**: At least 1 member
### Context Sharing
The system maintains your profile across all agent interactions:
- Once you provide your age, income, etc., agents use this context
- No need to repeat information
- More accurate, personalized responses
### Synchronous Operation
Each agent waits for previous processing to complete, ensuring:
- Coherent responses
- Proper context flow
- No race conditions
### Progress Indicators
Visual feedback during processing:
- π§ Routing your request
- π Analyzing policy documents
- β
Checking eligibility criteria
- π° Searching for benefits
- π’ Preparing guidance
## Example Workflows
### Check Benefits Workflow
1. Click "π° Check Benefits"
2. Enter: Age=35, Income=200000, Location=Maharashtra, Employment=Farmer, Family=4
3. System discovers PM-KISAN, PMFBY, Ayushman Bharat, etc.
4. View detailed results with eligibility reasoning
### Verify Eligibility Workflow
1. Click "β
Verify Eligibility"
2. Enter scheme: "Ayushman Bharat"
3. Provide profile information
4. Get clear YES/NO with reasoning and next steps
### Explain Policy Workflow
1. Click "π Explain Policy"
2. Enter policy: "PM-KISAN"
3. Select aspect: "Who is eligible?"
4. Read simple explanation with examples
### Help Application Workflow
1. Click "π Help Fill Application"
2. Enter scheme: "PM-SVANidhi"
3. Select documents you have
4. Choose stage: "Just starting"
5. Get step-by-step guidance
## Architecture
### New Files Created
- `src/user_interface.py` - Main Streamlit interface
- `src/question_config.py` - Question definitions for each option
- `src/validators.py` - Input validation utilities
### Modified Files
- `src/state.py` - Added user_profile, selected_option, collected_answers
- `src/graph.py` - Enhanced nodes to use user profile and support direct routing
### State Flow
```
User selects option β Answers questions β Validation β
Build query from answers β Set user_profile in state β
Route to agent (bypass orchestrator if intent known) β
Agent uses profile for context β Generate response β Display
```
## Troubleshooting
### "Module not found" errors
Ensure you're in the project root and virtual environment is activated:
```powershell
cd c:\Users\bhara\Desktop\Projects\zynd-protocals-application
.\venv\Scripts\activate
```
### Port already in use
Streamlit default port 8501 is busy:
```powershell
streamlit run src/user_interface.py --server.port 8502
```
### Validation errors
- Check that inputs match the expected format
- Age and income must be numbers
- Required fields cannot be empty
### No response generated
- Check logs in `logs/` directory
- Verify agents are functioning: `python src/main.py`
- Ensure LLM API keys are set in `.env`
## Next Steps
1. **Test all 4 options** with different inputs
2. **Try edge cases** (very high income, age=0, etc.)
3. **Test custom queries** outside the 4 main options
4. **Verify agent responses** are accurate and helpful
5. **Provide feedback** on question clarity and UX
## Benefits Over Old Interface
| Old Interface | New Interface |
|---------------|---------------|
| Free-form text only | Guided questions + free-form |
| No input validation | Comprehensive validation |
| User must know what to ask | Clear 4-option menu |
| No context preservation | User profile shared across agents |
| Text-based feedback | Visual progress indicators |
| Generic responses | Personalized based on profile |
|