Spaces:
Sleeping
Sleeping
Update definitions.py
Browse files- definitions.py +26 -26
definitions.py
CHANGED
@@ -32,6 +32,19 @@ def main():
|
|
32 |
autonomous_agent_app = AutonomousAgentApp()
|
33 |
app.run()
|
34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
class CodeMetricsAnalyzer:
|
36 |
"""Analyzes code metrics using various tools"""
|
37 |
|
@@ -288,21 +301,6 @@ class QualityMetrics:
|
|
288 |
"performance": 0.80
|
289 |
}
|
290 |
|
291 |
-
class ChatSystem:
|
292 |
-
"""Manages the chat interaction between users and the autonomous system."""
|
293 |
-
def __init__(self, agent: 'AutonomousAgent'):
|
294 |
-
self.agent = agent
|
295 |
-
self.chat_history = []
|
296 |
-
self.active_tasks = {}
|
297 |
-
self.command_handlers = {
|
298 |
-
'/task': self.handle_task_command,
|
299 |
-
'/status': self.handle_status_command,
|
300 |
-
'/stop': self.handle_stop_command,
|
301 |
-
'/help': self.handle_help_command,
|
302 |
-
'/modify': self.handle_modify_command
|
303 |
-
}
|
304 |
-
self.logger = logging.getLogger(__name__)
|
305 |
-
|
306 |
class AutonomousAgent:
|
307 |
"""Autonomous agent for the system."""
|
308 |
def __init__(self, app):
|
@@ -312,7 +310,7 @@ class AutonomousAgent:
|
|
312 |
self.refinement_loop = RefinementLoop(pipeline=self.pipeline)
|
313 |
self.interface = self.StreamlitInterface(self)
|
314 |
self.tools_repository = self._initialize_tool_repository()
|
315 |
-
self.chat_system = ChatSystem(self)
|
316 |
|
317 |
def initialize_tool_repository(self, tool_repository: object) -> None:
|
318 |
"""
|
@@ -354,13 +352,14 @@ class AutonomousAgent:
|
|
354 |
class StreamlitInterface:
|
355 |
"""Streamlit UI integration for the Autonomous Agent system."""
|
356 |
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
|
361 |
|
362 |
class ChatSystem:
|
363 |
"""Manages the chat interaction between users and the autonomous system."""
|
|
|
364 |
def __init__(self, agent):
|
365 |
self.agent = agent
|
366 |
self.chat_history = []
|
@@ -373,7 +372,7 @@ class AutonomousAgent:
|
|
373 |
'/modify': self.handle_modify_command
|
374 |
}
|
375 |
self.logger = logging.getLogger(__name__)
|
376 |
-
|
377 |
def render_chat_interface(self):
|
378 |
"""Render the chat interface in Streamlit sidebar."""
|
379 |
with st.sidebar:
|
@@ -401,12 +400,13 @@ class AutonomousAgent:
|
|
401 |
self.app.refinement_loop.run_refinement_cycle(task)
|
402 |
return "Task command handled"
|
403 |
|
404 |
-
def handle_status_command(self, input_data: Dict):
|
405 |
"""Handle status command."""
|
406 |
self.logger.info("Handling status command")
|
407 |
-
|
408 |
-
|
409 |
-
|
|
|
410 |
|
411 |
def handle_stop_command(self, input_data: Dict):
|
412 |
"""Handle stop command."""
|
@@ -595,7 +595,7 @@ class RefinementLoop:
|
|
595 |
|
596 |
|
597 |
def __init__(self, app):
|
598 |
-
|
599 |
self.app = app
|
600 |
self.workspace_manager = WorkspaceManager(workspace_dir=os.getenv('WORKSPACE_DIR', 'workspace'))
|
601 |
self.pipeline = self._initialize_pipeline()
|
@@ -603,7 +603,7 @@ class RefinementLoop:
|
|
603 |
self.interface = self.StreamlitInterface(self)
|
604 |
self.tools_repository = self._initialize_tool_repository()
|
605 |
self.chat_system = ChatSystem(self)
|
606 |
-
|
607 |
class ChatSystem:
|
608 |
"""Manages the chat interaction between users and the autonomous system."""
|
609 |
def __init__(self, agent):
|
|
|
32 |
autonomous_agent_app = AutonomousAgentApp()
|
33 |
app.run()
|
34 |
|
35 |
+
class AutonomousAgentApp:
|
36 |
+
"""Main application class for the Autonomous Agent System"""
|
37 |
+
|
38 |
+
def __init__(self):
|
39 |
+
self.autonomous_agent = AutonomousAgent(self)
|
40 |
+
self.workspace_manager = self.autonomous_agent.workspace_manager
|
41 |
+
self.refinement_loop = self.autonomous_agent.refinement_loop
|
42 |
+
self.interface = self.autonomous_agent.interface
|
43 |
+
|
44 |
+
def run(self):
|
45 |
+
"""Main entry point for the application"""
|
46 |
+
self.interface.render_main_interface()
|
47 |
+
|
48 |
class CodeMetricsAnalyzer:
|
49 |
"""Analyzes code metrics using various tools"""
|
50 |
|
|
|
301 |
"performance": 0.80
|
302 |
}
|
303 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
304 |
class AutonomousAgent:
|
305 |
"""Autonomous agent for the system."""
|
306 |
def __init__(self, app):
|
|
|
310 |
self.refinement_loop = RefinementLoop(pipeline=self.pipeline)
|
311 |
self.interface = self.StreamlitInterface(self)
|
312 |
self.tools_repository = self._initialize_tool_repository()
|
313 |
+
self.chat_system = ChatSystem(self)
|
314 |
|
315 |
def initialize_tool_repository(self, tool_repository: object) -> None:
|
316 |
"""
|
|
|
352 |
class StreamlitInterface:
|
353 |
"""Streamlit UI integration for the Autonomous Agent system."""
|
354 |
|
355 |
+
def __init__(self, app):
|
356 |
+
self.app = app
|
357 |
+
self.chat_system = self.app.chat_system
|
358 |
|
359 |
|
360 |
class ChatSystem:
|
361 |
"""Manages the chat interaction between users and the autonomous system."""
|
362 |
+
|
363 |
def __init__(self, agent):
|
364 |
self.agent = agent
|
365 |
self.chat_history = []
|
|
|
372 |
'/modify': self.handle_modify_command
|
373 |
}
|
374 |
self.logger = logging.getLogger(__name__)
|
375 |
+
|
376 |
def render_chat_interface(self):
|
377 |
"""Render the chat interface in Streamlit sidebar."""
|
378 |
with st.sidebar:
|
|
|
400 |
self.app.refinement_loop.run_refinement_cycle(task)
|
401 |
return "Task command handled"
|
402 |
|
403 |
+
def handle_status_command(self, input_data: Dict): # Fixed indentation
|
404 |
"""Handle status command."""
|
405 |
self.logger.info("Handling status command")
|
406 |
+
return {
|
407 |
+
"status": "success",
|
408 |
+
"history": self.agent.app.refinement_loop.get_refinement_history()
|
409 |
+
}
|
410 |
|
411 |
def handle_stop_command(self, input_data: Dict):
|
412 |
"""Handle stop command."""
|
|
|
595 |
|
596 |
|
597 |
def __init__(self, app):
|
598 |
+
"""Autonomous agent for the system."""
|
599 |
self.app = app
|
600 |
self.workspace_manager = WorkspaceManager(workspace_dir=os.getenv('WORKSPACE_DIR', 'workspace'))
|
601 |
self.pipeline = self._initialize_pipeline()
|
|
|
603 |
self.interface = self.StreamlitInterface(self)
|
604 |
self.tools_repository = self._initialize_tool_repository()
|
605 |
self.chat_system = ChatSystem(self)
|
606 |
+
|
607 |
class ChatSystem:
|
608 |
"""Manages the chat interaction between users and the autonomous system."""
|
609 |
def __init__(self, agent):
|