Spaces:
Sleeping
Sleeping
Fix UI styling - ensure consistent light backgrounds and proper text contrast
Browse files
src/second_brain_online/application/ui/conversation_analysis_ui.py
CHANGED
|
@@ -135,32 +135,32 @@ class ConversationAnalysisUI:
|
|
| 135 |
|
| 136 |
# Format the HTML content
|
| 137 |
html_content = f"""
|
| 138 |
-
<div class="conversation-details">
|
| 139 |
-
<h3>π Conversation Analysis: {conversation_id}</h3>
|
| 140 |
|
| 141 |
-
<div class="section">
|
| 142 |
-
<h4>π Summary (Contextual Summary)</h4>
|
| 143 |
-
<div class="content-box">
|
| 144 |
-
<p>{analysis.get('aggregated_contextual_summary', 'No summary available')}</p>
|
| 145 |
</div>
|
| 146 |
</div>
|
| 147 |
|
| 148 |
-
<div class="section">
|
| 149 |
-
<h4>π‘ Insights</h4>
|
| 150 |
"""
|
| 151 |
|
| 152 |
# Add quotes
|
| 153 |
quotes = insights.get('quotes', [])
|
| 154 |
if quotes:
|
| 155 |
-
html_content += "<h5>π Key Quotes:</h5><ul>"
|
| 156 |
for i, quote in enumerate(quotes, 1):
|
| 157 |
sentiment_class = f"sentiment-{quote.get('sentiment', 'neutral').lower()}"
|
| 158 |
html_content += f"""
|
| 159 |
-
<li>
|
| 160 |
-
<div class="quote-item">
|
| 161 |
-
<p><strong>Quote {i}:</strong> "{quote.get('quote', '')}"</p>
|
| 162 |
-
<p><strong>Context:</strong> {quote.get('context', '')}</p>
|
| 163 |
-
<p><strong>Sentiment:</strong> <span class="{sentiment_class}">{quote.get('sentiment', 'Unknown')}</span></p>
|
| 164 |
</div>
|
| 165 |
</li>
|
| 166 |
"""
|
|
@@ -169,15 +169,15 @@ class ConversationAnalysisUI:
|
|
| 169 |
# Add key findings
|
| 170 |
findings = insights.get('key_findings', [])
|
| 171 |
if findings:
|
| 172 |
-
html_content += "<h5>π Key Findings:</h5><ul>"
|
| 173 |
for i, finding in enumerate(findings, 1):
|
| 174 |
impact_class = f"impact-{finding.get('impact', 'medium').lower()}"
|
| 175 |
html_content += f"""
|
| 176 |
-
<li>
|
| 177 |
-
<div class="finding-item">
|
| 178 |
-
<p><strong>Finding {i}:</strong> {finding.get('finding', '')}</p>
|
| 179 |
-
<p><strong>Evidence:</strong> {finding.get('evidence', '')}</p>
|
| 180 |
-
<p><strong>Impact:</strong> <span class="{impact_class}">{finding.get('impact', 'Unknown')}</span></p>
|
| 181 |
</div>
|
| 182 |
</li>
|
| 183 |
"""
|
|
@@ -187,10 +187,10 @@ class ConversationAnalysisUI:
|
|
| 187 |
follow_up_email = analysis.get('follow_up_email', '')
|
| 188 |
if follow_up_email:
|
| 189 |
html_content += f"""
|
| 190 |
-
<div class="section">
|
| 191 |
-
<h4>π§ Follow-up Email</h4>
|
| 192 |
-
<div class="content-box">
|
| 193 |
-
<pre>{follow_up_email}</pre>
|
| 194 |
</div>
|
| 195 |
</div>
|
| 196 |
"""
|
|
@@ -211,27 +211,33 @@ class ConversationAnalysisUI:
|
|
| 211 |
.conversation-details {
|
| 212 |
max-width: 100%;
|
| 213 |
padding: 20px;
|
|
|
|
|
|
|
|
|
|
| 214 |
}
|
| 215 |
.section {
|
| 216 |
margin: 20px 0;
|
| 217 |
padding: 15px;
|
| 218 |
border: 1px solid #e0e0e0;
|
| 219 |
border-radius: 8px;
|
| 220 |
-
background-color: #
|
|
|
|
| 221 |
}
|
| 222 |
.content-box {
|
| 223 |
-
background-color:
|
| 224 |
padding: 15px;
|
| 225 |
border-radius: 5px;
|
| 226 |
border: 1px solid #dee2e6;
|
| 227 |
margin: 10px 0;
|
|
|
|
| 228 |
}
|
| 229 |
.quote-item, .finding-item {
|
| 230 |
margin: 10px 0;
|
| 231 |
padding: 10px;
|
| 232 |
-
background-color:
|
| 233 |
border-radius: 5px;
|
| 234 |
border-left: 4px solid #007bff;
|
|
|
|
| 235 |
}
|
| 236 |
.sentiment-positive {
|
| 237 |
background-color: #d4edda;
|
|
@@ -239,6 +245,7 @@ class ConversationAnalysisUI:
|
|
| 239 |
padding: 2px 8px;
|
| 240 |
border-radius: 4px;
|
| 241 |
font-weight: bold;
|
|
|
|
| 242 |
}
|
| 243 |
.sentiment-negative {
|
| 244 |
background-color: #f8d7da;
|
|
@@ -246,6 +253,7 @@ class ConversationAnalysisUI:
|
|
| 246 |
padding: 2px 8px;
|
| 247 |
border-radius: 4px;
|
| 248 |
font-weight: bold;
|
|
|
|
| 249 |
}
|
| 250 |
.sentiment-neutral {
|
| 251 |
background-color: #d1ecf1;
|
|
@@ -253,6 +261,7 @@ class ConversationAnalysisUI:
|
|
| 253 |
padding: 2px 8px;
|
| 254 |
border-radius: 4px;
|
| 255 |
font-weight: bold;
|
|
|
|
| 256 |
}
|
| 257 |
.sentiment-confused {
|
| 258 |
background-color: #fff3cd;
|
|
@@ -260,6 +269,7 @@ class ConversationAnalysisUI:
|
|
| 260 |
padding: 2px 8px;
|
| 261 |
border-radius: 4px;
|
| 262 |
font-weight: bold;
|
|
|
|
| 263 |
}
|
| 264 |
.impact-high {
|
| 265 |
background-color: #f8d7da;
|
|
@@ -267,6 +277,7 @@ class ConversationAnalysisUI:
|
|
| 267 |
padding: 2px 8px;
|
| 268 |
border-radius: 4px;
|
| 269 |
font-weight: bold;
|
|
|
|
| 270 |
}
|
| 271 |
.impact-medium {
|
| 272 |
background-color: #fff3cd;
|
|
@@ -274,6 +285,7 @@ class ConversationAnalysisUI:
|
|
| 274 |
padding: 2px 8px;
|
| 275 |
border-radius: 4px;
|
| 276 |
font-weight: bold;
|
|
|
|
| 277 |
}
|
| 278 |
.impact-low {
|
| 279 |
background-color: #d4edda;
|
|
@@ -281,6 +293,7 @@ class ConversationAnalysisUI:
|
|
| 281 |
padding: 2px 8px;
|
| 282 |
border-radius: 4px;
|
| 283 |
font-weight: bold;
|
|
|
|
| 284 |
}
|
| 285 |
.quality-high { color: #28a745; font-weight: bold; }
|
| 286 |
.quality-medium { color: #ffc107; font-weight: bold; }
|
|
|
|
| 135 |
|
| 136 |
# Format the HTML content
|
| 137 |
html_content = f"""
|
| 138 |
+
<div class="conversation-details" style="background-color: white; color: #333; padding: 20px;">
|
| 139 |
+
<h3 style="color: #333; background-color: white;">π Conversation Analysis: {conversation_id}</h3>
|
| 140 |
|
| 141 |
+
<div class="section" style="background-color: white; color: #333; border: 1px solid #e0e0e0; border-radius: 8px; padding: 15px; margin: 20px 0;">
|
| 142 |
+
<h4 style="color: #333; background-color: white;">π Summary (Contextual Summary)</h4>
|
| 143 |
+
<div class="content-box" style="background-color: #f8f9fa; color: #333; padding: 15px; border-radius: 5px; border: 1px solid #dee2e6; margin: 10px 0;">
|
| 144 |
+
<p style="color: #333; background-color: transparent;">{analysis.get('aggregated_contextual_summary', 'No summary available')}</p>
|
| 145 |
</div>
|
| 146 |
</div>
|
| 147 |
|
| 148 |
+
<div class="section" style="background-color: white; color: #333; border: 1px solid #e0e0e0; border-radius: 8px; padding: 15px; margin: 20px 0;">
|
| 149 |
+
<h4 style="color: #333; background-color: white;">π‘ Insights</h4>
|
| 150 |
"""
|
| 151 |
|
| 152 |
# Add quotes
|
| 153 |
quotes = insights.get('quotes', [])
|
| 154 |
if quotes:
|
| 155 |
+
html_content += "<h5 style='color: #333; background-color: white;'>π Key Quotes:</h5><ul style='color: #333; background-color: white;'>"
|
| 156 |
for i, quote in enumerate(quotes, 1):
|
| 157 |
sentiment_class = f"sentiment-{quote.get('sentiment', 'neutral').lower()}"
|
| 158 |
html_content += f"""
|
| 159 |
+
<li style='color: #333; background-color: white;'>
|
| 160 |
+
<div class="quote-item" style='background-color: #f8f9fa; color: #333; padding: 10px; border-radius: 5px; border-left: 4px solid #007bff; margin: 10px 0;'>
|
| 161 |
+
<p style='color: #333; background-color: transparent;'><strong>Quote {i}:</strong> "{quote.get('quote', '')}"</p>
|
| 162 |
+
<p style='color: #333; background-color: transparent;'><strong>Context:</strong> {quote.get('context', '')}</p>
|
| 163 |
+
<p style='color: #333; background-color: transparent;'><strong>Sentiment:</strong> <span class="{sentiment_class}">{quote.get('sentiment', 'Unknown')}</span></p>
|
| 164 |
</div>
|
| 165 |
</li>
|
| 166 |
"""
|
|
|
|
| 169 |
# Add key findings
|
| 170 |
findings = insights.get('key_findings', [])
|
| 171 |
if findings:
|
| 172 |
+
html_content += "<h5 style='color: #333; background-color: white;'>π Key Findings:</h5><ul style='color: #333; background-color: white;'>"
|
| 173 |
for i, finding in enumerate(findings, 1):
|
| 174 |
impact_class = f"impact-{finding.get('impact', 'medium').lower()}"
|
| 175 |
html_content += f"""
|
| 176 |
+
<li style='color: #333; background-color: white;'>
|
| 177 |
+
<div class="finding-item" style='background-color: #f8f9fa; color: #333; padding: 10px; border-radius: 5px; border-left: 4px solid #007bff; margin: 10px 0;'>
|
| 178 |
+
<p style='color: #333; background-color: transparent;'><strong>Finding {i}:</strong> {finding.get('finding', '')}</p>
|
| 179 |
+
<p style='color: #333; background-color: transparent;'><strong>Evidence:</strong> {finding.get('evidence', '')}</p>
|
| 180 |
+
<p style='color: #333; background-color: transparent;'><strong>Impact:</strong> <span class="{impact_class}">{finding.get('impact', 'Unknown')}</span></p>
|
| 181 |
</div>
|
| 182 |
</li>
|
| 183 |
"""
|
|
|
|
| 187 |
follow_up_email = analysis.get('follow_up_email', '')
|
| 188 |
if follow_up_email:
|
| 189 |
html_content += f"""
|
| 190 |
+
<div class="section" style="background-color: white; color: #333; border: 1px solid #e0e0e0; border-radius: 8px; padding: 15px; margin: 20px 0;">
|
| 191 |
+
<h4 style="color: #333; background-color: white;">π§ Follow-up Email</h4>
|
| 192 |
+
<div class="content-box" style="background-color: #f8f9fa; color: #333; padding: 15px; border-radius: 5px; border: 1px solid #dee2e6; margin: 10px 0;">
|
| 193 |
+
<pre style="color: #333; background-color: transparent; white-space: pre-wrap; font-family: monospace;">{follow_up_email}</pre>
|
| 194 |
</div>
|
| 195 |
</div>
|
| 196 |
"""
|
|
|
|
| 211 |
.conversation-details {
|
| 212 |
max-width: 100%;
|
| 213 |
padding: 20px;
|
| 214 |
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
| 215 |
+
background-color: white;
|
| 216 |
+
color: #333;
|
| 217 |
}
|
| 218 |
.section {
|
| 219 |
margin: 20px 0;
|
| 220 |
padding: 15px;
|
| 221 |
border: 1px solid #e0e0e0;
|
| 222 |
border-radius: 8px;
|
| 223 |
+
background-color: #ffffff;
|
| 224 |
+
color: #333;
|
| 225 |
}
|
| 226 |
.content-box {
|
| 227 |
+
background-color: #f8f9fa;
|
| 228 |
padding: 15px;
|
| 229 |
border-radius: 5px;
|
| 230 |
border: 1px solid #dee2e6;
|
| 231 |
margin: 10px 0;
|
| 232 |
+
color: #333;
|
| 233 |
}
|
| 234 |
.quote-item, .finding-item {
|
| 235 |
margin: 10px 0;
|
| 236 |
padding: 10px;
|
| 237 |
+
background-color: #f8f9fa;
|
| 238 |
border-radius: 5px;
|
| 239 |
border-left: 4px solid #007bff;
|
| 240 |
+
color: #333;
|
| 241 |
}
|
| 242 |
.sentiment-positive {
|
| 243 |
background-color: #d4edda;
|
|
|
|
| 245 |
padding: 2px 8px;
|
| 246 |
border-radius: 4px;
|
| 247 |
font-weight: bold;
|
| 248 |
+
display: inline-block;
|
| 249 |
}
|
| 250 |
.sentiment-negative {
|
| 251 |
background-color: #f8d7da;
|
|
|
|
| 253 |
padding: 2px 8px;
|
| 254 |
border-radius: 4px;
|
| 255 |
font-weight: bold;
|
| 256 |
+
display: inline-block;
|
| 257 |
}
|
| 258 |
.sentiment-neutral {
|
| 259 |
background-color: #d1ecf1;
|
|
|
|
| 261 |
padding: 2px 8px;
|
| 262 |
border-radius: 4px;
|
| 263 |
font-weight: bold;
|
| 264 |
+
display: inline-block;
|
| 265 |
}
|
| 266 |
.sentiment-confused {
|
| 267 |
background-color: #fff3cd;
|
|
|
|
| 269 |
padding: 2px 8px;
|
| 270 |
border-radius: 4px;
|
| 271 |
font-weight: bold;
|
| 272 |
+
display: inline-block;
|
| 273 |
}
|
| 274 |
.impact-high {
|
| 275 |
background-color: #f8d7da;
|
|
|
|
| 277 |
padding: 2px 8px;
|
| 278 |
border-radius: 4px;
|
| 279 |
font-weight: bold;
|
| 280 |
+
display: inline-block;
|
| 281 |
}
|
| 282 |
.impact-medium {
|
| 283 |
background-color: #fff3cd;
|
|
|
|
| 285 |
padding: 2px 8px;
|
| 286 |
border-radius: 4px;
|
| 287 |
font-weight: bold;
|
| 288 |
+
display: inline-block;
|
| 289 |
}
|
| 290 |
.impact-low {
|
| 291 |
background-color: #d4edda;
|
|
|
|
| 293 |
padding: 2px 8px;
|
| 294 |
border-radius: 4px;
|
| 295 |
font-weight: bold;
|
| 296 |
+
display: inline-block;
|
| 297 |
}
|
| 298 |
.quality-high { color: #28a745; font-weight: bold; }
|
| 299 |
.quality-medium { color: #ffc107; font-weight: bold; }
|