Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -569,7 +569,11 @@ def run_curator(state: EnhancedAgentState, progress_callback=None) -> EnhancedAg
|
|
| 569 |
if progress_callback:
|
| 570 |
progress_callback("🎯 Curator (mistral-small) selecting story...")
|
| 571 |
|
|
|
|
|
|
|
|
|
|
| 572 |
candidates = state.get("candidates", [])
|
|
|
|
| 573 |
candidates_text = candidates[0].get("raw", "") if candidates else ""
|
| 574 |
|
| 575 |
system_msg = SystemMessage(content="""You are the Curator Agent.
|
|
@@ -589,10 +593,12 @@ Then rank on:
|
|
| 589 |
|
| 590 |
Output: RANKED CANDIDATES, then SELECTED STORY with title uniqueness check.""")
|
| 591 |
|
|
|
|
|
|
|
| 592 |
if retry_count > 0:
|
| 593 |
-
instruction = f"Refine the
|
| 594 |
else:
|
| 595 |
-
instruction = f"
|
| 596 |
|
| 597 |
user_msg = HumanMessage(content=instruction)
|
| 598 |
|
|
|
|
| 569 |
if progress_callback:
|
| 570 |
progress_callback("🎯 Curator (mistral-small) selecting story...")
|
| 571 |
|
| 572 |
+
# --- FIX 1: Retrieve retry_count from state ---
|
| 573 |
+
retry_count = state.get("retry_count", 0)
|
| 574 |
+
|
| 575 |
candidates = state.get("candidates", [])
|
| 576 |
+
# This is the text we want to analyze
|
| 577 |
candidates_text = candidates[0].get("raw", "") if candidates else ""
|
| 578 |
|
| 579 |
system_msg = SystemMessage(content="""You are the Curator Agent.
|
|
|
|
| 593 |
|
| 594 |
Output: RANKED CANDIDATES, then SELECTED STORY with title uniqueness check.""")
|
| 595 |
|
| 596 |
+
# --- FIX 2 & 3: Fix undefined 'story_text' and adjust logic for Curator ---
|
| 597 |
+
# The Curator should be analyzing 'candidates_text', not writing the final post yet.
|
| 598 |
if retry_count > 0:
|
| 599 |
+
instruction = f"Refine the selection based on this feedback:\n{state.get('critic_feedback')}\n\nOriginal Candidates:\n{candidates_text}"
|
| 600 |
else:
|
| 601 |
+
instruction = f"Analyze and select the best story from:\n{candidates_text}"
|
| 602 |
|
| 603 |
user_msg = HumanMessage(content=instruction)
|
| 604 |
|