- 增加全局智能助手设置,开启后所有消息通过智能助手回答而无需使用 `/ai` 指令
- 问题修复与细节优化
This commit is contained in:
jxxghp
2025-11-23 13:55:16 +08:00
parent fd422d7446
commit 9b5f863832
6 changed files with 338 additions and 331 deletions

View File

@@ -1,7 +1,7 @@
"""查询媒体库工具"""
import json
from typing import Optional, List, Type
from typing import Optional, Type
from pydantic import BaseModel, Field
@@ -9,7 +9,6 @@ from app.agent.tools.base import MoviePilotTool
from app.chain.mediaserver import MediaServerChain
from app.core.context import MediaInfo
from app.log import logger
from app.schemas import MediaServerItem
from app.schemas.types import MediaType

View File

@@ -35,8 +35,6 @@ class SearchPersonCreditsTool(MoviePilotTool):
logger.info(f"执行工具: {self.name}, 参数: person_id={person_id}, source={source}, page={page}")
try:
medias = None
# 根据source选择相应的chain
if source.lower() == "tmdb":
tmdb_chain = TmdbChain()

View File

@@ -64,7 +64,8 @@ class SearchWebTool(MoviePilotTool):
logger.error(f"搜索网络内容失败: {e}", exc_info=True)
return error_message
async def _search_duckduckgo_api(self, query: str, max_results: int) -> list:
@staticmethod
async def _search_duckduckgo_api(query: str, max_results: int) -> list:
"""
使用DuckDuckGo API进行搜索
@@ -143,7 +144,8 @@ class SearchWebTool(MoviePilotTool):
logger.warning(f"DuckDuckGo API搜索失败: {e}")
return []
def _format_and_truncate_results(self, results: list, max_results: int) -> dict:
@staticmethod
def _format_and_truncate_results(results: list, max_results: int) -> dict:
"""
格式化并裁剪搜索结果以避免占用过多上下文