File size: 1,114 Bytes
b4f2238 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | """跨模块依赖注入 - 隔离 cases 模块对其他 app 的导入."""
from __future__ import annotations
from typing import TYPE_CHECKING, cast
if TYPE_CHECKING:
from apps.automation.services.chat.factory import ChatProviderFactory
from apps.core.dto.chat import MessageContent
from apps.documents.services.placeholders import EnhancedContextBuilder
def get_chat_provider_factory() -> type[ChatProviderFactory]:
"""获取群聊提供者工厂类"""
from apps.automation.services.chat.factory import ChatProviderFactory
return cast(type[ChatProviderFactory], ChatProviderFactory)
def create_message_content(*, title: str, text: str, file_path: str | None = None) -> MessageContent:
"""创建消息内容实例"""
from apps.automation.services.chat.base import MessageContent
return MessageContent(title=title, text=text, file_path=file_path)
def get_enhanced_context_builder() -> EnhancedContextBuilder:
"""获取增强上下文构建器实例"""
from apps.documents.services.placeholders import EnhancedContextBuilder
return EnhancedContextBuilder()
|