mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-05-01 15:22:37 +00:00
Refactor EventListener tree node creation and remove unused method
This commit is contained in:
@@ -79,9 +79,6 @@ class EventListener(BaseEventListener):
|
|||||||
self.console = Console(width=None)
|
self.console = Console(width=None)
|
||||||
self.tool_usage_counts = {}
|
self.tool_usage_counts = {}
|
||||||
|
|
||||||
def _format_timestamp(self, timestamp: float) -> str:
|
|
||||||
return datetime.fromtimestamp(timestamp).strftime("%H:%M:%S")
|
|
||||||
|
|
||||||
def _create_panel(self, content: Text, title: str, style: str = "blue") -> Panel:
|
def _create_panel(self, content: Text, title: str, style: str = "blue") -> Panel:
|
||||||
"""Create a standardized panel with consistent styling."""
|
"""Create a standardized panel with consistent styling."""
|
||||||
return Panel(
|
return Panel(
|
||||||
@@ -396,10 +393,9 @@ class EventListener(BaseEventListener):
|
|||||||
|
|
||||||
self.current_flow_tree = Tree(flow_label)
|
self.current_flow_tree = Tree(flow_label)
|
||||||
|
|
||||||
# Add both creation steps to show progression
|
self._add_tree_node(self.current_flow_tree, "✨ Created", "blue")
|
||||||
self.current_flow_tree.add(Text("✨ Created", style="blue"))
|
self._add_tree_node(
|
||||||
self.current_flow_tree.add(
|
self.current_flow_tree, "✅ Initialization Complete", "green"
|
||||||
Text("✅ Initialization Complete", style="green")
|
|
||||||
)
|
)
|
||||||
|
|
||||||
self.console.print(self.current_flow_tree)
|
self.console.print(self.current_flow_tree)
|
||||||
@@ -419,8 +415,7 @@ class EventListener(BaseEventListener):
|
|||||||
"In Progress",
|
"In Progress",
|
||||||
)
|
)
|
||||||
|
|
||||||
# Add initial thinking state
|
self._add_tree_node(self.current_flow_tree, "🧠 Initializing...", "yellow")
|
||||||
self.current_flow_tree.add(Text("🧠 Initializing...", style="yellow"))
|
|
||||||
|
|
||||||
self.console.print()
|
self.console.print()
|
||||||
self.console.print(self.current_flow_tree)
|
self.console.print(self.current_flow_tree)
|
||||||
@@ -642,7 +637,9 @@ class EventListener(BaseEventListener):
|
|||||||
test_label.append("In Progress", style="yellow")
|
test_label.append("In Progress", style="yellow")
|
||||||
|
|
||||||
self.current_flow_tree = Tree(test_label)
|
self.current_flow_tree = Tree(test_label)
|
||||||
self.current_flow_tree.add(Text("🔄 Running tests...", style="yellow"))
|
self._add_tree_node(
|
||||||
|
self.current_flow_tree, "🔄 Running tests...", "yellow"
|
||||||
|
)
|
||||||
|
|
||||||
self.console.print(self.current_flow_tree)
|
self.console.print(self.current_flow_tree)
|
||||||
self.console.print()
|
self.console.print()
|
||||||
|
|||||||
Reference in New Issue
Block a user