9ca31e45e0
- 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()
51 lines
1.2 KiB
Python
51 lines
1.2 KiB
Python
"""Torrent application DTOs."""
|
|
|
|
from dataclasses import dataclass
|
|
from typing import Any
|
|
|
|
|
|
@dataclass
|
|
class SearchTorrentsResponse:
|
|
"""Response from searching for torrents."""
|
|
|
|
status: str
|
|
torrents: list[dict[str, Any]] | None = None
|
|
count: int | None = None
|
|
error: str | None = None
|
|
message: str | None = None
|
|
|
|
def to_dict(self):
|
|
"""Convert to dict for agent compatibility."""
|
|
result = {"status": self.status}
|
|
|
|
if self.error:
|
|
result["error"] = self.error
|
|
result["message"] = self.message
|
|
else:
|
|
if self.torrents is not None:
|
|
result["torrents"] = self.torrents
|
|
if self.count is not None:
|
|
result["count"] = self.count
|
|
|
|
return result
|
|
|
|
|
|
@dataclass
|
|
class AddTorrentResponse:
|
|
"""Response from adding a torrent."""
|
|
|
|
status: str
|
|
message: str | None = None
|
|
error: str | None = None
|
|
|
|
def to_dict(self):
|
|
"""Convert to dict for agent compatibility."""
|
|
result = {"status": self.status}
|
|
|
|
if self.error:
|
|
result["error"] = self.error
|
|
if self.message:
|
|
result["message"] = self.message
|
|
|
|
return result
|