refactor: streamline data serialization in tool implementations

- Replaced model_dump and to_dict methods with direct calls to dict for improved consistency and performance in JSON serialization across multiple tools.
- Updated ConversationMemoryManager, GetRecommendationsTool, QueryDownloadsTool, and QueryMediaLibraryTool to enhance data handling.
This commit is contained in:
jxxghp
2025-10-31 11:36:50 +08:00
parent 055117d83d
commit 3971c145df
5 changed files with 5 additions and 5 deletions

View File

@@ -27,7 +27,7 @@ class QueryDownloadsTool(MoviePilotTool):
continue
filtered_downloads.append(dl)
if filtered_downloads:
return json.dumps([d.dict() if hasattr(d, 'dict') else d.model_dump() if hasattr(d, 'model_dump') else d for d in filtered_downloads], ensure_ascii=False, indent=2)
return json.dumps([d.dict() for d in filtered_downloads])
return "未找到相关下载任务。"
except Exception as e:
logger.error(f"查询下载失败: {e}", exc_info=True)