fix: 将 DeepAgent 的断言改为警告,使其在没有 Tavily Key 时也能加载出智能体选项并正常使用
This commit is contained in:
parent
5a376dd1b9
commit
28428a53d1
@ -18,7 +18,7 @@ from src.services.mcp_service import get_tools_from_all_servers
|
|||||||
|
|
||||||
from .context import DeepContext
|
from .context import DeepContext
|
||||||
from .prompts import DEEP_PROMPT
|
from .prompts import DEEP_PROMPT
|
||||||
|
from src.utils import logger
|
||||||
|
|
||||||
def _get_research_sub_agent(search_tools: list) -> dict:
|
def _get_research_sub_agent(search_tools: list) -> dict:
|
||||||
"""Get research sub-agent config with search tools."""
|
"""Get research sub-agent config with search tools."""
|
||||||
@ -85,11 +85,14 @@ class DeepAgent(BaseAgent):
|
|||||||
if tavily_search:
|
if tavily_search:
|
||||||
tools.append(tavily_search)
|
tools.append(tavily_search)
|
||||||
|
|
||||||
# Assert that search tool is available for DeepAgent
|
# # Assert that search tool is available for DeepAgent
|
||||||
assert tools, (
|
# assert tools, (
|
||||||
"DeepAgent requires at least one search tool. "
|
# "DeepAgent requires at least one search tool. "
|
||||||
"Please configure TAVILY_API_KEY environment variable to enable web search."
|
# "Please configure TAVILY_API_KEY environment variable to enable web search."
|
||||||
)
|
# )
|
||||||
|
if not tools:
|
||||||
|
logger.warning("No search tools configured, DeepAgent will work without web search")
|
||||||
|
tools = []
|
||||||
return tools
|
return tools
|
||||||
|
|
||||||
async def get_graph(self, **kwargs):
|
async def get_graph(self, **kwargs):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user