导入方式修改
Some checks failed
构建并部署 AI Agent 服务 / deploy (push) Failing after 6m44s

This commit is contained in:
2026-05-05 23:17:00 +08:00
parent b5c15ef445
commit 3ae9daa01a
51 changed files with 445 additions and 532 deletions

View File

@@ -23,20 +23,19 @@ class NewsAPIClient:
news_repository: Optional[Any] = None
def __post_init__(self):
"""初始化后设置MCP"""
import asyncio
try:
asyncio.create_task(self._init_mcp())
except RuntimeError:
pass
"""初始化后设置(延迟初始化标志)"""
self._mcp_initialized = False # 延迟初始化标志
async def _init_mcp(self):
"""初始化MCP系统"""
"""初始化MCP系统(延迟初始化)"""
if self._mcp_initialized:
return # 已初始化,跳过
if not mcp_manager.get_adapter("news"):
mcp_manager.register_adapter(
NewsAdapter(news_repo=self.news_repository)
)
await mcp_manager.initialize()
self._mcp_initialized = True
async def query_news(
self,

View File

@@ -7,7 +7,7 @@ from typing import Dict, Any
from datetime import datetime
# 公共工具
from app.core import MarkdownFormatter
from ...core import MarkdownFormatter
from .state import (
NewsAnalysisState,