Spaces:
Sleeping
Sleeping
Update agents/report_generation_agent.py
Browse files
agents/report_generation_agent.py
CHANGED
@@ -373,33 +373,67 @@ class ReportGeneratorAgent:
|
|
373 |
|
374 |
elif format == "html":
|
375 |
# Format as HTML
|
376 |
-
html = fr"""
|
377 |
-
<div class="report">
|
378 |
-
|
379 |
-
|
380 |
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
</div>
|
402 |
-
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
403 |
return html
|
404 |
|
405 |
else:
|
|
|
373 |
|
374 |
elif format == "html":
|
375 |
# Format as HTML
|
376 |
+
# html = fr"""
|
377 |
+
# <div class="report">
|
378 |
+
# <h1>Report: {report.get('topic', 'Unknown Topic')}</h1>
|
379 |
+
# <p class="timestamp"><em>Generated on: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}</em></p>
|
380 |
|
381 |
+
# <h2>Executive Summary</h2>
|
382 |
+
# <div class="summary">
|
383 |
+
# <p>{report.get('executive_summary', 'No summary available.')}</p>
|
384 |
+
# </div>
|
385 |
|
386 |
+
# <div class="confidence">
|
387 |
+
# <p><strong>Confidence Level: {report.get('confidence_level', 'unknown').title()}</strong></p>
|
388 |
+
# <p><em>{self.generate_confidence_statement(report.get('confidence_level', 'low'))}</em></p>
|
389 |
+
# </div>
|
390 |
|
391 |
+
# <h2>Detailed Report</h2>
|
392 |
+
# <div class="detailed-report">
|
393 |
+
# {report.get('detailed_report', 'No detailed report available.').replace('\\n', '<br>')}
|
394 |
+
# </div>
|
395 |
|
396 |
+
# <h2>Sources</h2>
|
397 |
+
# <ul>
|
398 |
+
# <li>Text Documents: {report.get('sources', {}).get('text_documents', 0)}</li>
|
399 |
+
# <li>Images: {report.get('sources', {}).get('images', 0)}</li>
|
400 |
+
# </ul>
|
401 |
+
# </div>
|
402 |
+
# """
|
403 |
+
# Start with the opening tags
|
404 |
+
html = "<div class=\"report\">\n"
|
405 |
+
html += f" <h1>Report: {report.get('topic', 'Unknown Topic')}</h1>\n"
|
406 |
+
html += f" <p class=\"timestamp\"><em>Generated on: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}</em></p>\n"
|
407 |
+
|
408 |
+
# Executive Summary section
|
409 |
+
html += " <h2>Executive Summary</h2>\n"
|
410 |
+
html += " <div class=\"summary\">\n"
|
411 |
+
html += f" <p>{report.get('executive_summary', 'No summary available.')}</p>\n"
|
412 |
+
html += " </div>\n"
|
413 |
+
|
414 |
+
# Confidence section
|
415 |
+
html += " <div class=\"confidence\">\n"
|
416 |
+
html += f" <p><strong>Confidence Level: {report.get('confidence_level', 'unknown').title()}</strong></p>\n"
|
417 |
+
html += f" <p><em>{self.generate_confidence_statement(report.get('confidence_level', 'low'))}</em></p>\n"
|
418 |
+
html += " </div>\n"
|
419 |
+
|
420 |
+
# Detailed Report section
|
421 |
+
html += " <h2>Detailed Report</h2>\n"
|
422 |
+
html += " <div class=\"detailed-report\">\n"
|
423 |
+
detailed_report = report.get('detailed_report', 'No detailed report available.').replace('\n', '<br>')
|
424 |
+
html += f" {detailed_report}\n"
|
425 |
+
html += " </div>\n"
|
426 |
+
|
427 |
+
# Sources section
|
428 |
+
html += " <h2>Sources</h2>\n"
|
429 |
+
html += " <ul>\n"
|
430 |
+
html += f" <li>Text Documents: {report.get('sources', {}).get('text_documents', 0)}</li>\n"
|
431 |
+
html += f" <li>Images: {report.get('sources', {}).get('images', 0)}</li>\n"
|
432 |
+
html += " </ul>\n"
|
433 |
+
|
434 |
+
# Close the main div
|
435 |
+
html += "</div>\n"
|
436 |
+
|
437 |
return html
|
438 |
|
439 |
else:
|