Spaces:
Sleeping
Sleeping
Update definitions.py
Browse files- definitions.py +29 -3
definitions.py
CHANGED
@@ -224,14 +224,40 @@ def _calculate_trend(self, values: List[float]) -> Dict[str, Any]:
|
|
224 |
"previous": recent_values[0]
|
225 |
}
|
226 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
227 |
class AutonomousAgentApp:
|
228 |
"""Main application class for the Autonomous Agent System"""
|
229 |
|
230 |
def __init__(self):
|
231 |
-
self.workspace_manager =
|
232 |
self.pipeline = self._initialize_pipeline()
|
233 |
-
self.refinement_loop = self.RefinementLoop(pipeline=self.pipeline)
|
234 |
-
self.interface = self.StreamlitInterface(self)
|
235 |
|
236 |
def _initialize_pipeline(self) -> 'AutonomousAgentApp.DevelopmentPipeline':
|
237 |
"""Initialize the development pipeline"""
|
|
|
224 |
"previous": recent_values[0]
|
225 |
}
|
226 |
|
227 |
+
class WorkspaceManager:
|
228 |
+
"""Manages the workspace for the Autonomous Agent System."""
|
229 |
+
|
230 |
+
def __init__(self, workspace_dir: str):
|
231 |
+
self.workspace_dir = workspace_dir
|
232 |
+
|
233 |
+
def get_workspace_tree(self) -> Dict[str, Any]:
|
234 |
+
"""Get the structure of the workspace."""
|
235 |
+
# Placeholder implementation
|
236 |
+
return {"workspace": "tree_structure"}
|
237 |
+
|
238 |
+
def create_file(self, filename: str, content: str) -> str:
|
239 |
+
"""Create a new file in the workspace."""
|
240 |
+
file_path = os.path.join(self.workspace_dir, filename)
|
241 |
+
with open(file_path, 'w') as file:
|
242 |
+
file.write(content)
|
243 |
+
return f"File '{filename}' created successfully."
|
244 |
+
|
245 |
+
def delete_file(self, filename: str) -> str:
|
246 |
+
"""Delete a file from the workspace."""
|
247 |
+
file_path = os.path.join(self.workspace_dir, filename)
|
248 |
+
if os.path.exists(file_path):
|
249 |
+
os.remove(file_path)
|
250 |
+
return f"File '{filename}' deleted successfully."
|
251 |
+
return f"File '{filename}' not found."
|
252 |
+
|
253 |
class AutonomousAgentApp:
|
254 |
"""Main application class for the Autonomous Agent System"""
|
255 |
|
256 |
def __init__(self):
|
257 |
+
self.workspace_manager = WorkspaceManager(workspace_dir=os.getenv('WORKSPACE_DIR', 'workspace'))
|
258 |
self.pipeline = self._initialize_pipeline()
|
259 |
+
self.refinement_loop = self.RefinementLoop(pipeline=self.pipeline)
|
260 |
+
self.interface = self.StreamlitInterface(self)
|
261 |
|
262 |
def _initialize_pipeline(self) -> 'AutonomousAgentApp.DevelopmentPipeline':
|
263 |
"""Initialize the development pipeline"""
|