File size: 8,873 Bytes
8b7e8f0 | 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 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 | import streamlit as st
from src.utils.config import config
def show_settings_interface():
"""Display the settings interface."""
st.header("⚙️ Settings")
st.markdown("Configure your Lega.AI experience")
# Tabs for different settings categories
tab1, tab2, tab3, tab4 = st.tabs(
["🔑 API Keys", "🎨 Preferences", "📊 Usage", "ℹ️ About"]
)
with tab1:
show_api_settings()
with tab2:
show_preference_settings()
with tab3:
show_usage_stats()
with tab4:
show_about_info()
def show_api_settings():
"""Display API key configuration."""
st.subheader("🔑 API Configuration")
# Check current API key status
api_key_configured = bool(
config.GOOGLE_API_KEY and config.GOOGLE_API_KEY != "your-google-api-key-here"
)
if api_key_configured:
st.success("✅ Google AI API key is configured")
else:
st.warning("⚠️ Google AI API key not configured")
st.markdown(
"""
To use Lega.AI's AI features, you need to configure your Google AI API key:
1. Go to [Google AI Studio](https://makersuite.google.com/)
2. Create a new API key
3. Copy the key and add it to your `.env` file
4. Set `GOOGLE_API_KEY=your_actual_api_key`
5. Restart the application
"""
)
# API key input (for demonstration)
st.markdown("---")
st.subheader("🔧 Update API Key")
with st.form("api_key_form"):
new_api_key = st.text_input(
"Google AI API Key",
type="password",
placeholder="Enter your Google AI API key",
help="This will be saved to your environment configuration",
)
submitted = st.form_submit_button("Update API Key")
if submitted:
if new_api_key.strip():
st.success(
"✅ API key updated! Please restart the application for changes to take effect."
)
st.info("💡 Don't forget to update your `.env` file with the new key.")
else:
st.error("❌ Please enter a valid API key")
def show_preference_settings():
"""Display user preference settings."""
st.subheader("🎨 User Preferences")
# Language settings
st.markdown("#### 🌐 Language & Region")
col1, col2 = st.columns(2)
with col1:
language = st.selectbox(
"Interface Language",
["English", "Hindi", "Tamil", "Telugu", "Gujarati"],
help="Language for the user interface",
)
with col2:
region = st.selectbox(
"Legal Region",
["India", "Maharashtra", "Delhi", "Karnataka", "Tamil Nadu"],
help="Legal jurisdiction for document analysis",
)
# Analysis preferences
st.markdown("#### 📊 Analysis Preferences")
risk_sensitivity = st.slider(
"Risk Detection Sensitivity",
min_value=1,
max_value=5,
value=3,
help="1 = Only critical risks, 5 = All potential concerns",
)
simplification_level = st.selectbox(
"Text Simplification Level",
["Basic", "Intermediate", "Advanced"],
index=1,
help="How much to simplify legal language",
)
show_suggestions = st.checkbox(
"Show improvement suggestions",
value=True,
help="Display suggestions for problematic clauses",
)
# Notification preferences
st.markdown("#### 🔔 Notifications")
email_notifications = st.checkbox(
"Email notifications for analysis completion", value=False
)
browser_notifications = st.checkbox("Browser notifications", value=True)
# Save preferences
if st.button("💾 Save Preferences", type="primary"):
# In a real app, save to user profile/database
st.success("✅ Preferences saved successfully!")
def show_usage_stats():
"""Display usage statistics."""
st.subheader("📊 Usage Statistics")
# Mock usage data
col1, col2, col3 = st.columns(3)
with col1:
st.metric(label="Documents Analyzed", value="47", delta="12 this month")
with col2:
st.metric(label="Questions Asked", value="156", delta="23 this week")
with col3:
st.metric(label="Risks Identified", value="89", delta="High: 12, Medium: 31")
# Usage by document type
st.markdown("#### 📄 Analysis by Document Type")
usage_data = {
"Rental Agreements": 18,
"Loan Contracts": 12,
"Employment Contracts": 8,
"Service Agreements": 6,
"NDAs": 3,
}
for doc_type, count in usage_data.items():
progress = count / max(usage_data.values())
st.markdown(f"**{doc_type}**: {count} documents")
st.progress(progress)
# Storage usage
st.markdown("#### 💾 Storage Usage")
storage_used = 2.4 # GB
storage_limit = 5.0 # GB
st.progress(storage_used / storage_limit)
st.markdown(
f"**{storage_used:.1f} GB** used of **{storage_limit:.1f} GB** available"
)
# Account tier
st.markdown("#### 👤 Account Information")
col1, col2 = st.columns(2)
with col1:
st.info("**Plan**: Free Tier")
st.markdown(
"""
- 10 documents per month
- Basic AI analysis
- Email support
"""
)
with col2:
st.markdown("**Upgrade Benefits**:")
st.markdown(
"""
- Unlimited documents
- Advanced AI features
- Priority support
- Bulk processing
"""
)
if st.button("🚀 Upgrade to Pro", type="primary"):
st.info("Upgrade functionality would be implemented here")
def show_about_info():
"""Display about information."""
st.subheader("ℹ️ About Lega.AI")
# App info
col1, col2 = st.columns([2, 1])
with col1:
st.markdown(
"""
**Lega.AI** is an AI-powered platform that makes legal documents accessible to everyone.
### 🎯 Mission
To democratize legal document understanding by providing instant AI analysis,
risk assessment, and plain language explanations.
### ✨ Features
- **Document Analysis**: Upload and analyze any legal document
- **Risk Assessment**: Color-coded risk scoring with explanations
- **Plain Language**: Convert legal jargon to simple English
- **Q&A Assistant**: Ask questions about your documents
- **Smart Search**: Find similar clauses and documents
- **Export Reports**: Generate comprehensive analysis reports
### 🛡️ Privacy & Security
- Your documents are processed securely
- No data is shared with third parties
- Local vector storage for document similarity
- GDPR compliant data handling
"""
)
with col2:
st.markdown(
"""
### 📊 Version Info
**Version**: 1.0.0
**Build**: 2025.09.21
**Engine**: Google Gemini
### 🔧 Tech Stack
- **Frontend**: Streamlit
- **AI/ML**: LangChain + Gemini
- **Vector DB**: Chroma
- **Embeddings**: Google Embeddings
### 📞 Support
- **Email**: support@lega.ai
- **Docs**: github.com/codernoahx/Lega.AI/README.md
- **GitHub**: github.com/codernoahx/Lega.AI
"""
)
# Legal notice
st.markdown("---")
st.markdown(
"""
### ⚖️ Legal Notice
**Disclaimer**: Lega.AI provides AI-powered analysis for informational purposes only.
This is not legal advice. Always consult with qualified legal professionals for
important legal matters.
**Data Usage**: By using this service, you agree to our Terms of Service and Privacy Policy.
Your documents are processed to provide analysis but are not used to train AI models.
© 2025 Lega.AI. All rights reserved.
"""
)
# Feedback section
st.markdown("---")
st.subheader("💬 Feedback")
with st.form("feedback_form"):
feedback_type = st.selectbox(
"Feedback Type",
["General Feedback", "Bug Report", "Feature Request", "Question"],
)
feedback_text = st.text_area(
"Your Feedback",
placeholder="Tell us what you think or report any issues...",
height=100,
)
submitted = st.form_submit_button("Send Feedback")
if submitted and feedback_text.strip():
st.success("✅ Thank you for your feedback! We'll review it soon.")
elif submitted:
st.error("❌ Please enter your feedback before submitting.")
|