feat!: migrate to OpenAI native tool calls and fix circular deps (#fuck-gemini)
- Fix circular dependencies in agent/tools - Migrate from custom JSON to OpenAI tool calls format - Add async streaming (step_stream, complete_stream) - Simplify prompt system and remove token counting - Add 5 new API endpoints (/health, /v1/models, /api/memory/*) - Add 3 new tools (get_torrent_by_index, add_torrent_by_index, set_language) - Fix all 500 tests and add coverage config (80% threshold) - Add comprehensive docs (README, pytest guide) BREAKING: LLM interface changed, memory injection via get_memory()
This commit is contained in:
+15
-34
@@ -1,59 +1,40 @@
|
||||
"""Filesystem tools - Adapted for DDD architecture."""
|
||||
from typing import Dict, Any
|
||||
"""Filesystem tools for folder management."""
|
||||
|
||||
# Import use cases
|
||||
from application.filesystem import SetFolderPathUseCase, ListFolderUseCase
|
||||
from typing import Any
|
||||
|
||||
# Import infrastructure
|
||||
from application.filesystem import ListFolderUseCase, SetFolderPathUseCase
|
||||
from infrastructure.filesystem import FileManager
|
||||
from infrastructure.persistence.memory import Memory
|
||||
|
||||
|
||||
def set_path_for_folder(memory: Memory, folder_name: str, path_value: str) -> Dict[str, Any]:
|
||||
def set_path_for_folder(folder_name: str, path_value: str) -> dict[str, Any]:
|
||||
"""
|
||||
Set a path in the configuration.
|
||||
Set a folder path in the configuration.
|
||||
|
||||
Args:
|
||||
memory: Memory instance to store the configuration
|
||||
folder_name: Name of folder to set (download, tvshow, movie, torrent)
|
||||
path_value: Absolute path to the folder
|
||||
folder_name: Name of folder to set (download, tvshow, movie, torrent).
|
||||
path_value: Absolute path to the folder.
|
||||
|
||||
Returns:
|
||||
Dict with status or error information
|
||||
Dict with status or error information.
|
||||
"""
|
||||
# Create file manager
|
||||
file_manager = FileManager(memory)
|
||||
|
||||
# Create use case
|
||||
file_manager = FileManager()
|
||||
use_case = SetFolderPathUseCase(file_manager)
|
||||
|
||||
# Execute use case
|
||||
response = use_case.execute(folder_name, path_value)
|
||||
|
||||
# Return as dict
|
||||
return response.to_dict()
|
||||
|
||||
|
||||
def list_folder(memory: Memory, folder_type: str, path: str = ".") -> Dict[str, Any]:
|
||||
def list_folder(folder_type: str, path: str = ".") -> dict[str, Any]:
|
||||
"""
|
||||
List contents of a folder.
|
||||
List contents of a configured folder.
|
||||
|
||||
Args:
|
||||
memory: Memory instance to retrieve the configuration
|
||||
folder_type: Type of folder to list (download, tvshow, movie, torrent)
|
||||
path: Relative path within the folder (default: ".")
|
||||
folder_type: Type of folder to list (download, tvshow, movie, torrent).
|
||||
path: Relative path within the folder (default: root).
|
||||
|
||||
Returns:
|
||||
Dict with folder contents or error information
|
||||
Dict with folder contents or error information.
|
||||
"""
|
||||
# Create file manager
|
||||
file_manager = FileManager(memory)
|
||||
|
||||
# Create use case
|
||||
file_manager = FileManager()
|
||||
use_case = ListFolderUseCase(file_manager)
|
||||
|
||||
# Execute use case
|
||||
response = use_case.execute(folder_type, path)
|
||||
|
||||
# Return as dict
|
||||
return response.to_dict()
|
||||
|
||||
Reference in New Issue
Block a user