refactor: 移除多余的空行,优化类型导入及方法为静态方法

This commit is contained in:
jxxghp
2026-03-30 17:07:45 +08:00
parent cbff2fed17
commit e61299f748
9 changed files with 3 additions and 10 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ import asyncio
import base64 import base64
import json import json
from enum import Enum from enum import Enum
from typing import Optional, Type, List from typing import Optional, Type
from pydantic import BaseModel, Field from pydantic import BaseModel, Field
@@ -160,4 +160,3 @@ class QueryPopularSubscribesTool(MoviePilotTool):
except Exception as e: except Exception as e:
logger.error(f"查询热门订阅失败: {e}", exc_info=True) logger.error(f"查询热门订阅失败: {e}", exc_info=True)
return f"查询热门订阅时发生错误: {str(e)}" return f"查询热门订阅时发生错误: {str(e)}"
@@ -62,4 +62,3 @@ class QueryRuleGroupsTool(MoviePilotTool):
"message": error_message, "message": error_message,
"rule_groups": [] "rule_groups": []
}, ensure_ascii=False) }, ensure_ascii=False)
-1
View File
@@ -52,4 +52,3 @@ class QuerySchedulersTool(MoviePilotTool):
except Exception as e: except Exception as e:
logger.error(f"查询定时服务失败: {e}", exc_info=True) logger.error(f"查询定时服务失败: {e}", exc_info=True)
return f"查询定时服务时发生错误: {str(e)}" return f"查询定时服务时发生错误: {str(e)}"
@@ -114,4 +114,3 @@ class QuerySubscribeHistoryTool(MoviePilotTool):
except Exception as e: except Exception as e:
logger.error(f"查询订阅历史失败: {e}", exc_info=True) logger.error(f"查询订阅历史失败: {e}", exc_info=True)
return f"查询订阅历史时发生错误: {str(e)}" return f"查询订阅历史时发生错误: {str(e)}"
@@ -110,4 +110,3 @@ class QuerySubscribeSharesTool(MoviePilotTool):
except Exception as e: except Exception as e:
logger.error(f"查询订阅分享失败: {e}", exc_info=True) logger.error(f"查询订阅分享失败: {e}", exc_info=True)
return f"查询订阅分享时发生错误: {str(e)}" return f"查询订阅分享时发生错误: {str(e)}"
-1
View File
@@ -125,4 +125,3 @@ class QueryWorkflowsTool(MoviePilotTool):
except Exception as e: except Exception as e:
logger.error(f"查询工作流失败: {e}", exc_info=True) logger.error(f"查询工作流失败: {e}", exc_info=True)
return f"查询工作流时发生错误: {str(e)}" return f"查询工作流时发生错误: {str(e)}"
+2 -2
View File
@@ -99,7 +99,8 @@ class RecognizeMediaTool(MoviePilotTool):
"message": error_message "message": error_message
}, ensure_ascii=False) }, ensure_ascii=False)
def _format_context_result(self, context: Context, source_type: str) -> str: @staticmethod
def _format_context_result(context: Context, source_type: str) -> str:
"""格式化识别结果为JSON字符串""" """格式化识别结果为JSON字符串"""
if not context: if not context:
return json.dumps({ return json.dumps({
@@ -160,4 +161,3 @@ class RecognizeMediaTool(MoviePilotTool):
} }
return json.dumps(result, ensure_ascii=False, indent=2) return json.dumps(result, ensure_ascii=False, indent=2)
-1
View File
@@ -47,4 +47,3 @@ class TestSiteTool(MoviePilotTool):
except Exception as e: except Exception as e:
logger.error(f"测试站点连通性失败: {e}", exc_info=True) logger.error(f"测试站点连通性失败: {e}", exc_info=True)
return f"测试站点连通性时发生错误: {str(e)}" return f"测试站点连通性时发生错误: {str(e)}"