GuglielmoTor commited on
Commit
8853c45
·
verified ·
1 Parent(s): 794a271

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -24
app.py CHANGED
@@ -82,33 +82,14 @@ except ImportError as e:
82
  gr.update(value=empty_header_html), # report_header_html_display (7)
83
  gr.update(value=empty_body_markdown), # report_body_markdown_display (8)
84
  {}, # reconstruction_cache_st (9)
85
- gr.update(value=get_initial_okr_display()) # NEW: enhanced_okr_display_html (10)
 
86
  )
87
  def fetch_and_reconstruct_data_from_bubble(*args, **kwargs):
88
  return None, {}
89
  def format_report_for_display(report_data):
90
  # Placeholder for when modules are not loaded, returns structure matching the new design
91
  return {'header_html': '<h1>Agentic modules not loaded.</h1>', 'body_markdown': 'Report display unavailable.'}
92
- # REMOVED from insights_ui_generator.py, so also remove placeholder if not needed by other direct calls
93
- # def extract_key_results_for_selection(okr_data):
94
- # return []
95
- # def format_single_okr_for_display(okr_data, **kwargs):
96
- # return "Agentic modules not loaded. OKR display unavailable."
97
-
98
-
99
- # --- ANALYTICS TAB MODULE IMPORT ---
100
- from services.analytics_tab_module import AnalyticsTab
101
-
102
- # Configure logging
103
- logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(module)s - %(message)s')
104
-
105
- # API Key Setup
106
- user_provided_api_key = os.environ.get("GEMINI_API_KEY")
107
- if user_provided_api_key:
108
- os.environ["GOOGLE_API_KEY"] = user_provided_api_key
109
- logging.info("GOOGLE_API_KEY environment variable has been set from GEMINI_API_KEY.")
110
- else:
111
- logging.error("CRITICAL ERROR: The API key environment variable 'GEMINI_API_KEY' was not found.")
112
 
113
 
114
  with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue", secondary_hue="sky"),
@@ -138,6 +119,8 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue", secondary_hue="sky"),
138
 
139
  # --- NEW: Session-specific cache for reconstructed OKR data ---
140
  reconstruction_cache_st = gr.State({})
 
 
141
 
142
 
143
  # --- UI LAYOUT ---
@@ -305,7 +288,8 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue", secondary_hue="sky"),
305
  report_header_html_display, # 7: New HTML output for header
306
  report_body_markdown_display, # 8: New Markdown output for body
307
  reconstruction_cache_st, # 9: Reconstruction cache state
308
- enhanced_okr_display_html # 10: NEW: The enhanced HTML display for OKRs
 
309
  ]
310
 
311
  initial_load_event = org_urn_display.change(
@@ -324,12 +308,12 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue", secondary_hue="sky"),
324
  ).then(
325
  fn=load_and_display_agentic_results,
326
  inputs=[token_state, reconstruction_cache_st],
327
- # MODIFIED: Updated outputs to match all components returned by load_and_display_agentic_results
328
  outputs=agentic_display_outputs,
329
  show_progress="minimal"
330
  ).then( # NEW CHAIN: Update the enhanced OKR display after load_and_display_agentic_results runs
331
  fn=format_okrs_for_enhanced_display,
332
- inputs=[orchestration_raw_results_st], # Take the raw results as input
333
  outputs=[enhanced_okr_display_html],
334
  show_progress="minimal"
335
  )
 
82
  gr.update(value=empty_header_html), # report_header_html_display (7)
83
  gr.update(value=empty_body_markdown), # report_body_markdown_display (8)
84
  {}, # reconstruction_cache_st (9)
85
+ gr.update(value=get_initial_okr_display()), # NEW: enhanced_okr_display_html (10)
86
+ gr.update(value={}) # NEW: actionable_okrs_data_st (11)
87
  )
88
  def fetch_and_reconstruct_data_from_bubble(*args, **kwargs):
89
  return None, {}
90
  def format_report_for_display(report_data):
91
  # Placeholder for when modules are not loaded, returns structure matching the new design
92
  return {'header_html': '<h1>Agentic modules not loaded.</h1>', 'body_markdown': 'Report display unavailable.'}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
 
94
 
95
  with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue", secondary_hue="sky"),
 
119
 
120
  # --- NEW: Session-specific cache for reconstructed OKR data ---
121
  reconstruction_cache_st = gr.State({})
122
+ # NEW: State to hold the actionable_okrs dictionary explicitly
123
+ actionable_okrs_data_st = gr.State({})
124
 
125
 
126
  # --- UI LAYOUT ---
 
288
  report_header_html_display, # 7: New HTML output for header
289
  report_body_markdown_display, # 8: New Markdown output for body
290
  reconstruction_cache_st, # 9: Reconstruction cache state
291
+ enhanced_okr_display_html, # 10: NEW: The enhanced HTML display for OKRs
292
+ actionable_okrs_data_st # 11: NEW: The actionable_okrs dictionary state
293
  ]
294
 
295
  initial_load_event = org_urn_display.change(
 
308
  ).then(
309
  fn=load_and_display_agentic_results,
310
  inputs=[token_state, reconstruction_cache_st],
311
+ # MODIFIED: Updated outputs to match all components returned by load_and_display_agentic_results (now 12)
312
  outputs=agentic_display_outputs,
313
  show_progress="minimal"
314
  ).then( # NEW CHAIN: Update the enhanced OKR display after load_and_display_agentic_results runs
315
  fn=format_okrs_for_enhanced_display,
316
+ inputs=[actionable_okrs_data_st], # Take the new explicit actionable_okrs_data_st as input
317
  outputs=[enhanced_okr_display_html],
318
  show_progress="minimal"
319
  )