GuglielmoTor commited on
Commit
81af3e7
·
verified ·
1 Parent(s): 5cb07dc

Update run_agentic_pipeline.py

Browse files
Files changed (1) hide show
  1. run_agentic_pipeline.py +8 -14
run_agentic_pipeline.py CHANGED
@@ -159,6 +159,9 @@ def load_and_display_agentic_results(token_state: dict, session_cache: dict):
159
  # --- MODIFIED: Use the session cache for data reconstruction ---
160
  reconstructed_data, updated_cache = fetch_and_reconstruct_data_from_bubble(latest_report_series, session_cache)
161
 
 
 
 
162
  raw_results_state = None
163
  okr_details_md = "No OKRs found in the latest report." # This is for the old, hidden component
164
  enhanced_okr_html_content = get_initial_okr_display() # Default to loading state or empty
@@ -168,22 +171,14 @@ def load_and_display_agentic_results(token_state: dict, session_cache: dict):
168
  if reconstructed_data:
169
  raw_results_state = reconstructed_data
170
  actionable_okrs_dict = raw_results_state.get("actionable_okrs", {})
171
- if actionable_okrs_dict:
 
 
172
  # Format for the new enhanced HTML display
173
  enhanced_okr_html_content = format_okrs_for_enhanced_display(raw_results_state)
174
-
175
- # The following is for the old, hidden components. Keep for signature compatibility.
176
- # all_krs_state = extract_key_results_for_selection(actionable_okrs_dict) # REMOVED direct usage
177
- # if all_krs_state:
178
- # kr_choices = [(kr['kr_description'], kr['unique_kr_id']) for kr in all_krs_state]
179
- # key_results_cbg_update = gr.update(choices=kr_choices, value=[], interactive=True)
180
- # okrs_list = actionable_okrs_dict.get("okrs", [])
181
- # output_md_parts = [format_single_okr_for_display(okr, okr_main_index=i) for i, okr in enumerate(okrs_list)]
182
- # okr_details_md = "\n\n---\n\n".join(output_md_parts) if output_md_parts else okr_details_md
183
- # else:
184
- # logger.info(f"No actionable_okrs found in reconstructed data for report ID {latest_report_id}.")
185
  else:
186
- logger.info(f"No 'actionable_okrs' key found in reconstructed data for report ID {latest_report_id}.")
 
187
  enhanced_okr_html_content = get_initial_okr_display() # Show empty state if no OKRs
188
  else:
189
  logger.error(f"Failed to reconstruct data for latest report ID {latest_report_id}")
@@ -237,4 +232,3 @@ def load_and_display_agentic_results(token_state: dict, session_cache: dict):
237
  gr.update(value=session_cache), # 9
238
  gr.update(value=get_initial_okr_display()) # 10: Placeholder for enhanced OKR display on error
239
  )
240
-
 
159
  # --- MODIFIED: Use the session cache for data reconstruction ---
160
  reconstructed_data, updated_cache = fetch_and_reconstruct_data_from_bubble(latest_report_series, session_cache)
161
 
162
+ # DEBUGGING: Log the full reconstructed_data to inspect its structure
163
+ logger.info(f"DEBUG: Reconstructed Data Content for report {latest_report_id}: {reconstructed_data}")
164
+
165
  raw_results_state = None
166
  okr_details_md = "No OKRs found in the latest report." # This is for the old, hidden component
167
  enhanced_okr_html_content = get_initial_okr_display() # Default to loading state or empty
 
171
  if reconstructed_data:
172
  raw_results_state = reconstructed_data
173
  actionable_okrs_dict = raw_results_state.get("actionable_okrs", {})
174
+
175
+ # Refined check for actionable_okrs_dict content
176
+ if actionable_okrs_dict and isinstance(actionable_okrs_dict, dict) and actionable_okrs_dict.get("okrs"):
177
  # Format for the new enhanced HTML display
178
  enhanced_okr_html_content = format_okrs_for_enhanced_display(raw_results_state)
 
 
 
 
 
 
 
 
 
 
 
179
  else:
180
+ logger.info(f"No 'actionable_okrs' key or 'okrs' list found in reconstructed data for report ID {latest_report_id}. "
181
+ f"Content of 'actionable_okrs_dict': {actionable_okrs_dict}")
182
  enhanced_okr_html_content = get_initial_okr_display() # Show empty state if no OKRs
183
  else:
184
  logger.error(f"Failed to reconstruct data for latest report ID {latest_report_id}")
 
232
  gr.update(value=session_cache), # 9
233
  gr.update(value=get_initial_okr_display()) # 10: Placeholder for enhanced OKR display on error
234
  )