Update functions.py
Browse files- functions.py +25 -2
functions.py
CHANGED
|
@@ -83,7 +83,7 @@ def get_report_sections(report_type):
|
|
| 83 |
}
|
| 84 |
return report_sections.get(report_type, [])
|
| 85 |
|
| 86 |
-
def
|
| 87 |
"""
|
| 88 |
Generate all sections for the specified report type.
|
| 89 |
"""
|
|
@@ -108,7 +108,30 @@ def generate_all_sections(data):
|
|
| 108 |
|
| 109 |
return sections_content # Return the content dictionary
|
| 110 |
|
| 111 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
# Define the actual generation functions, like:
|
| 113 |
def generate_executive_summary(data):
|
| 114 |
return f"Executive Summary for {data['research_topic']}"
|
|
|
|
| 83 |
}
|
| 84 |
return report_sections.get(report_type, [])
|
| 85 |
|
| 86 |
+
def generate_all_sections_0(data):
|
| 87 |
"""
|
| 88 |
Generate all sections for the specified report type.
|
| 89 |
"""
|
|
|
|
| 108 |
|
| 109 |
return sections_content # Return the content dictionary
|
| 110 |
|
| 111 |
+
|
| 112 |
+
def generate_report_section(section_to_generate, data):
|
| 113 |
+
"""
|
| 114 |
+
Generate content for a selected report section.
|
| 115 |
+
"""
|
| 116 |
+
# Get report sections based on the report type
|
| 117 |
+
report_type = data.get("report_type")
|
| 118 |
+
report_sections = get_report_sections(report_type)
|
| 119 |
+
|
| 120 |
+
# Dynamically call the function based on the selected section
|
| 121 |
+
section_function_name = dict(report_sections).get(section_to_generate)
|
| 122 |
+
|
| 123 |
+
# Update session tracker to log the generated section (optional if session tracking is needed)
|
| 124 |
+
update_session_tracker(section_to_generate)
|
| 125 |
+
|
| 126 |
+
# Call the corresponding section generation function
|
| 127 |
+
if section_function_name:
|
| 128 |
+
section_content = call_dynamic_function(section_function_name, data)
|
| 129 |
+
return section_content
|
| 130 |
+
else:
|
| 131 |
+
return "Error: Section function not found."
|
| 132 |
+
|
| 133 |
+
|
| 134 |
+
|
| 135 |
# Define the actual generation functions, like:
|
| 136 |
def generate_executive_summary(data):
|
| 137 |
return f"Executive Summary for {data['research_topic']}"
|