This commit is contained in:
subiz
2025-10-05 19:25:06 +08:00
7 changed files with 26 additions and 21 deletions

View File

@@ -9,17 +9,18 @@
"""
import traceback
from typing import Any
from typing import TYPE_CHECKING, Any
from rich.traceback import install
from src.chat.message_receive.chat_stream import ChatStream
from src.chat.replyer.default_generator import DefaultReplyer
from src.chat.replyer.replyer_manager import replyer_manager
from src.chat.utils.utils import process_llm_response
from src.common.logger import get_logger
from src.plugin_system.base.component_types import ActionInfo
if TYPE_CHECKING:
from src.chat.replyer.default_generator import DefaultReplyer
install(extra_lines=3)
# 日志记录器
@@ -35,7 +36,7 @@ async def get_replyer(
chat_stream: ChatStream | None = None,
chat_id: str | None = None,
request_type: str = "replyer",
) -> DefaultReplyer | None:
) -> Any | None:
"""获取回复器对象
优先使用chat_stream如果没有则使用chat_id直接查找。
@@ -56,6 +57,8 @@ async def get_replyer(
raise ValueError("chat_stream 和 chat_id 不可均为空")
try:
logger.debug(f"[GeneratorAPI] 正在获取回复器chat_id: {chat_id}, chat_stream: {'' if chat_stream else ''}")
# 动态导入避免循环依赖
from src.chat.replyer.replyer_manager import replyer_manager
return await replyer_manager.get_replyer(
chat_stream=chat_stream,
chat_id=chat_id,