akashe commited on
Commit
2bfc8fd
Β·
1 Parent(s): 72e4d3c

more verbosity

Browse files
Files changed (2) hide show
  1. app.py +1 -1
  2. section_agent.py +8 -8
app.py CHANGED
@@ -127,7 +127,7 @@ _Research is running in parallel across all sections..._
127
  # Get display name and color for completion message
128
  display_name = res.get("display_name", sec.replace("_", " ").title())
129
  section_color = res.get("section_color", "#95a5a6")
130
- yield (f'<span style="color: {section_color};">βœ… **{display_name}** complete</span> β€” {hl_count} insights extracted (confidence: {conf:.0%})', None)
131
  except Exception as e:
132
  print("Something went wrong")
133
  yield (f"⚠️ A section failed: {e}", None)
 
127
  # Get display name and color for completion message
128
  display_name = res.get("display_name", sec.replace("_", " ").title())
129
  section_color = res.get("section_color", "#95a5a6")
130
+ yield (f'<span style="color: {section_color}; font-weight: bold;">βœ… {display_name} complete β€” {hl_count} insights extracted (confidence: {conf:.0%})</span>', None)
131
  except Exception as e:
132
  print("Something went wrong")
133
  yield (f"⚠️ A section failed: {e}", None)
section_agent.py CHANGED
@@ -76,7 +76,7 @@ class SectionResearchManager:
76
 
77
  # ---------- Step 1: Complexity Assessment ----------
78
  if progress_callback:
79
- await progress_callback(f'<span style="color: {section_color};">🧠 **{display_name}** for "{topic}": Analyzing research complexity...</span>')
80
  print(f"[{section}] Running Complexity Assessment")
81
  complexity_raw = await Runner.run(self.complexity_agent, as_messages(base_payload))
82
 
@@ -97,7 +97,7 @@ class SectionResearchManager:
97
 
98
  print(f"[{section}] Complexity: {complexity_level}, Recommended queries: {recommended_count}")
99
  if progress_callback:
100
- await progress_callback(f'<span style="color: {section_color};">πŸ” **{display_name}** for "{topic}": Planning {recommended_count} search queries (complexity: {complexity_level})</span>')
101
 
102
  # ---------- Step 2: Query Generation ----------
103
  query_payload = {
@@ -121,7 +121,7 @@ class SectionResearchManager:
121
  actual_queries = len(query_gen_result.get("queries", []))
122
  print(f"[{section}] Generated {actual_queries} queries (target: {recommended_count})")
123
  if progress_callback:
124
- await progress_callback(f'<span style="color: {section_color};">🌐 **{display_name}** for "{topic}": Searching the web with {actual_queries} targeted queries...</span>')
125
 
126
  # Update run_params with dynamic query count for researcher
127
  dynamic_run_params = base_payload["run_params"].copy()
@@ -158,7 +158,7 @@ class SectionResearchManager:
158
  # ---------- Step 4: Analysis ----------
159
  facts_count = len(researcher_result.get("facts", []))
160
  if progress_callback:
161
- await progress_callback(f'<span style="color: {section_color};">πŸ§ͺ **{display_name}** for "{topic}": Deep-analyzing {facts_count} facts and sources...</span>')
162
 
163
  analyst_payload = {
164
  **base_payload,
@@ -179,7 +179,7 @@ class SectionResearchManager:
179
  critic_result = {}
180
  if self.enable_critic:
181
  if progress_callback:
182
- await progress_callback(f'<span style="color: {section_color};">πŸ”¬ **{display_name}** for "{topic}": Checking quality & identifying gaps...</span>')
183
 
184
  critic_payload = {
185
  **base_payload,
@@ -212,7 +212,7 @@ class SectionResearchManager:
212
  # ---------- Step 6: Self-Healing Research Loop (if needed) ----------
213
  if self.enable_critic and needs_iteration and len(gap_queries_raw) > 0:
214
  if progress_callback:
215
- await progress_callback(f'<span style="color: {section_color};">πŸ”„ **{display_name}** for "{topic}": Filling knowledge gaps with {len(gap_queries_raw[:5])} additional searches...</span>')
216
  print(f"[{section}] Triggering self-healing loop: {iteration_reason}")
217
 
218
  # Use Critic's gap queries (already formatted)
@@ -260,7 +260,7 @@ class SectionResearchManager:
260
 
261
  print(f"[{section}] Merged {len(new_facts)} new facts, total: {len(merged_facts)}")
262
  if progress_callback:
263
- await progress_callback(f'<span style="color: {section_color};">πŸ”¬ **{display_name}** for "{topic}": Re-analyzing with {len(merged_facts)} facts (+{len(new_facts)} new)...</span>')
264
 
265
  # Re-run analyst with ALL facts (original + iteration facts)
266
  iteration_analyst_payload = {
@@ -295,7 +295,7 @@ class SectionResearchManager:
295
  # ---------- Step 7: Editor (Always Runs Once at the End) ----------
296
  if progress_callback:
297
  iteration_status = "enhanced with gap-fill" if (self.enable_critic and needs_iteration and len(gap_queries_raw) > 0) else "ready"
298
- await progress_callback(f'<span style="color: {section_color};">✏️ **{display_name}** for "{topic}": Finalizing insights ({iteration_status})...</span>')
299
 
300
  editor_payload = {
301
  **base_payload,
 
76
 
77
  # ---------- Step 1: Complexity Assessment ----------
78
  if progress_callback:
79
+ await progress_callback(f'<span style="color: {section_color}; font-weight: bold;">🧠 {display_name} for "{topic}": Analyzing research complexity...</span>')
80
  print(f"[{section}] Running Complexity Assessment")
81
  complexity_raw = await Runner.run(self.complexity_agent, as_messages(base_payload))
82
 
 
97
 
98
  print(f"[{section}] Complexity: {complexity_level}, Recommended queries: {recommended_count}")
99
  if progress_callback:
100
+ await progress_callback(f'<span style="color: {section_color}; font-weight: bold;">πŸ” {display_name} for "{topic}": Planning {recommended_count} search queries (complexity: {complexity_level})</span>')
101
 
102
  # ---------- Step 2: Query Generation ----------
103
  query_payload = {
 
121
  actual_queries = len(query_gen_result.get("queries", []))
122
  print(f"[{section}] Generated {actual_queries} queries (target: {recommended_count})")
123
  if progress_callback:
124
+ await progress_callback(f'<span style="color: {section_color}; font-weight: bold;">🌐 {display_name} for "{topic}": Searching the web with {actual_queries} targeted queries...</span>')
125
 
126
  # Update run_params with dynamic query count for researcher
127
  dynamic_run_params = base_payload["run_params"].copy()
 
158
  # ---------- Step 4: Analysis ----------
159
  facts_count = len(researcher_result.get("facts", []))
160
  if progress_callback:
161
+ await progress_callback(f'<span style="color: {section_color}; font-weight: bold;">πŸ§ͺ {display_name} for "{topic}": Deep-analyzing {facts_count} facts and sources...</span>')
162
 
163
  analyst_payload = {
164
  **base_payload,
 
179
  critic_result = {}
180
  if self.enable_critic:
181
  if progress_callback:
182
+ await progress_callback(f'<span style="color: {section_color}; font-weight: bold;">πŸ”¬ {display_name} for "{topic}": Checking quality & identifying gaps...</span>')
183
 
184
  critic_payload = {
185
  **base_payload,
 
212
  # ---------- Step 6: Self-Healing Research Loop (if needed) ----------
213
  if self.enable_critic and needs_iteration and len(gap_queries_raw) > 0:
214
  if progress_callback:
215
+ await progress_callback(f'<span style="color: {section_color}; font-weight: bold;">πŸ”„ {display_name} for "{topic}": Filling knowledge gaps with {len(gap_queries_raw[:5])} additional searches...</span>')
216
  print(f"[{section}] Triggering self-healing loop: {iteration_reason}")
217
 
218
  # Use Critic's gap queries (already formatted)
 
260
 
261
  print(f"[{section}] Merged {len(new_facts)} new facts, total: {len(merged_facts)}")
262
  if progress_callback:
263
+ await progress_callback(f'<span style="color: {section_color}; font-weight: bold;">πŸ”¬ {display_name} for "{topic}": Re-analyzing with {len(merged_facts)} facts (+{len(new_facts)} new)...</span>')
264
 
265
  # Re-run analyst with ALL facts (original + iteration facts)
266
  iteration_analyst_payload = {
 
295
  # ---------- Step 7: Editor (Always Runs Once at the End) ----------
296
  if progress_callback:
297
  iteration_status = "enhanced with gap-fill" if (self.enable_critic and needs_iteration and len(gap_queries_raw) > 0) else "ready"
298
+ await progress_callback(f'<span style="color: {section_color}; font-weight: bold;">✏️ {display_name} for "{topic}": Finalizing insights ({iteration_status})...</span>')
299
 
300
  editor_payload = {
301
  **base_payload,