Update functions.py
Browse files- functions.py +13 -18
functions.py
CHANGED
|
@@ -108,41 +108,36 @@ def generate_all_sections_0(data):
|
|
| 108 |
|
| 109 |
return sections_content # Return the content dictionary
|
| 110 |
|
| 111 |
-
|
| 112 |
def generate_all_sections(data):
|
| 113 |
-
"""
|
| 114 |
-
Generate all sections for the specified report type and update the session tracker.
|
| 115 |
-
"""
|
| 116 |
sections_content = {}
|
| 117 |
-
|
| 118 |
-
# Get the report type from data
|
| 119 |
report_type = data.get("report_type")
|
| 120 |
-
|
| 121 |
-
# Retrieve sections based on report type
|
| 122 |
report_sections = get_report_sections(report_type)
|
| 123 |
|
| 124 |
-
# Loop through each section and generate content
|
| 125 |
for section_name, function_name in report_sections:
|
| 126 |
if function_name == "generate_all_sections":
|
| 127 |
continue # Skip "All Sections" itself
|
| 128 |
-
|
| 129 |
-
# Update the session tracker for each section
|
| 130 |
update_session_tracker(section_name)
|
| 131 |
|
| 132 |
-
#
|
|
|
|
|
|
|
|
|
|
| 133 |
section_function_name = dict(report_sections)[section_name]
|
| 134 |
section_content = call_dynamic_function(section_function_name, data)
|
| 135 |
|
| 136 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
sections_content[section_name] = section_content
|
| 138 |
-
|
| 139 |
-
st.subheader(section_name) # Show the section title
|
| 140 |
-
st.write(section_content) # Show the section content as it is generated
|
| 141 |
-
|
| 142 |
-
|
| 143 |
return sections_content
|
| 144 |
|
| 145 |
|
|
|
|
| 146 |
# Define the actual generation functions, like:
|
| 147 |
def generate_executive_summary(data):
|
| 148 |
return f"Executive Summary for {data['research_topic']}"
|
|
|
|
| 108 |
|
| 109 |
return sections_content # Return the content dictionary
|
| 110 |
|
|
|
|
| 111 |
def generate_all_sections(data):
|
|
|
|
|
|
|
|
|
|
| 112 |
sections_content = {}
|
|
|
|
|
|
|
| 113 |
report_type = data.get("report_type")
|
|
|
|
|
|
|
| 114 |
report_sections = get_report_sections(report_type)
|
| 115 |
|
|
|
|
| 116 |
for section_name, function_name in report_sections:
|
| 117 |
if function_name == "generate_all_sections":
|
| 118 |
continue # Skip "All Sections" itself
|
| 119 |
+
|
|
|
|
| 120 |
update_session_tracker(section_name)
|
| 121 |
|
| 122 |
+
# Debugging step: Ensure each section is being processed
|
| 123 |
+
st.write(f"Generating content for: {section_name}")
|
| 124 |
+
|
| 125 |
+
# Call the dynamic function and ensure data is being passed correctly
|
| 126 |
section_function_name = dict(report_sections)[section_name]
|
| 127 |
section_content = call_dynamic_function(section_function_name, data)
|
| 128 |
|
| 129 |
+
if not section_content:
|
| 130 |
+
st.error(f"No content generated for {section_name}")
|
| 131 |
+
else:
|
| 132 |
+
st.subheader(section_name)
|
| 133 |
+
st.write(section_content)
|
| 134 |
+
|
| 135 |
sections_content[section_name] = section_content
|
| 136 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
return sections_content
|
| 138 |
|
| 139 |
|
| 140 |
+
|
| 141 |
# Define the actual generation functions, like:
|
| 142 |
def generate_executive_summary(data):
|
| 143 |
return f"Executive Summary for {data['research_topic']}"
|