Skip to content

Commit c73fb19

Browse files
committed
Fixed bugs in new model
1 parent 8abe10a commit c73fb19

File tree

2 files changed

+40
-76
lines changed

2 files changed

+40
-76
lines changed

src/backend/v3/models/models.py

Lines changed: 40 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
1-
from typing import Any, List
1+
import uuid
2+
from datetime import datetime, timezone
3+
from enum import Enum
4+
from typing import List, Optional
25

3-
from pydantic import BaseModel
6+
from pydantic import BaseModel, Field
47

58

9+
class PlanStatus(str, Enum):
10+
CREATED = "created"
11+
QUEUED = "queued"
12+
RUNNING = "running"
13+
COMPLETED = "completed"
14+
FAILED = "failed"
15+
CANCELLED = "cancelled"
16+
617
class MStep(BaseModel):
718
"""model of a step in a plan"""
819
_agent: str = ""
920
action: str = ""
10-
21+
1122
@property
1223
def agent(self):
1324
return self._agent
@@ -16,15 +27,32 @@ def agent(self):
1627
def agent(self, value):
1728
self._agent = value if value is not None else ""
1829

19-
2030
class MPlan(BaseModel):
21-
"""model of a plan"""
22-
session_id: str = ""
23-
user_id: str = ""
24-
team_id: str = ""
25-
plan_id: str = ""
26-
user_request: str = ""
31+
id: str = Field(default_factory=lambda: str(uuid.uuid4()))
32+
session_id: Optional[str] = None
33+
team_id: Optional[str] = None
34+
user_id: Optional[str] = None
35+
overall_status: PlanStatus = PlanStatus.CREATED
36+
progress: int = 0 # 0-100 percentage
37+
current_step: Optional[str] = None
38+
result: Optional[str] = None
39+
error_message: Optional[str] = None
40+
created_at: datetime = Field(datetime.now(timezone.utc))
41+
updated_at: datetime = Field(datetime.now(timezone.utc))
42+
estimated_completion: Optional[datetime] = None
43+
user_request: Optional[str] = None
2744
team: List[str] = []
28-
facts: str = ""
29-
steps: List[MStep] = []
45+
facts: Optional[str] = None
46+
steps: List[MStep] = Field(default_factory=list)
47+
48+
# class MPlan(BaseModel):
49+
# """model of a plan"""
50+
# session_id: str = ""
51+
# user_id: str = ""
52+
# team_id: str = ""
53+
# plan_id: str = ""
54+
# user_request: str = ""
55+
# team: List[str] = []
56+
# facts: str = ""
57+
# steps: List[MStep] = []
3058

src/backend/v3/orchestration/human_approval_manager.py

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -108,70 +108,6 @@ async def _get_plan_approval_with_details(self, task: str, participant_descripti
108108
else:
109109
print("Please enter 'y' for yes, 'n' for no, or 'details' for more info")
110110

111-
# def _show_detailed_plan_info(self, task: str, participant_descriptions: dict, plan: Any = None):
112-
"""Show detailed information about the planned execution."""
113-
print("\n📖 Detailed Plan Information:")
114-
print("-" * 80)
115-
116-
# Show the actual plan details if provided
117-
if plan:
118-
print("🔍 Plan Content Analysis:")
119-
try:
120-
if hasattr(plan, 'content') and plan.content:
121-
# Parse the plan into structured JSON format
122-
parsed_plan = self._parse_plan_to_json(plan.content, participant_descriptions)
123-
124-
print(" 📊 Structured Analysis:")
125-
print(f" Task Summary: {parsed_plan['plan_description']['task_summary']}")
126-
print(f" Complexity: {parsed_plan['plan_description']['complexity_assessment']}")
127-
print(f" Total Steps: {len(parsed_plan['steps'])}")
128-
129-
print(" 📋 Step-by-Step Breakdown:")
130-
for step in parsed_plan['steps']:
131-
print(f" {step['step_number']}. [{step['step_agent']}]")
132-
print(f" Action: {step['step_prompt']}")
133-
134-
print(" 📄 Raw Plan Content:")
135-
content_lines = plan.content.split('\n')
136-
for line in content_lines:
137-
if line.strip():
138-
print(f" → {line.strip()}")
139-
140-
elif hasattr(plan, '__dict__'):
141-
print(" Plan object attributes:")
142-
for key, value in plan.__dict__.items():
143-
print(f" {key}: {str(value)[:100]}...")
144-
except Exception as e:
145-
print(f" Error analyzing plan: {e}")
146-
147-
# Analyze task type and show expected flow
148-
task_lower = task.lower()
149-
150-
if any(word in task_lower for word in ['research', 'find', 'search', 'current', 'latest']):
151-
print("\n🔍 Research-Heavy Task Detected:")
152-
print(" → Research Agent will search for current information")
153-
print(" → May use Bing search tools and MCP capabilities")
154-
print(" → Results will be analyzed by Reasoning Agent")
155-
156-
if any(word in task_lower for word in ['analyze', 'calculate', 'data', 'metrics', 'chart']):
157-
print("\n🔢 Analysis Task Detected:")
158-
print(" → Coder Agent will process and analyze data")
159-
print(" → May create visualizations and calculations")
160-
print(" → Research Agent may gather supporting data")
161-
162-
if any(word in task_lower for word in ['design', 'plan', 'strategy', 'recommend']):
163-
print("\n🧠 Strategic Planning Task Detected:")
164-
print(" → Reasoning Agent will lead strategic analysis")
165-
print(" → Research Agent will gather best practices")
166-
print(" → Comprehensive recommendations will be provided")
167-
168-
print(f"\n👥 Available Agents:")
169-
for agent_name, description in participant_descriptions.items():
170-
print(f" • {agent_name}: {description}")
171-
172-
print(f"\n📝 Task: {task}")
173-
print("\nThe Magentic Manager will automatically coordinate these agents")
174-
print("based on the task requirements and agent capabilities.")
175111

176112
def plan_to_obj(self, magentic_context, ledger) -> MPlan:
177113
"""

0 commit comments

Comments
 (0)