11# coding=utf-8
22"""
3- @project: MaxKB
4- @file: aggregator_factory.py
5- @date:2026/7/22 16:24
6- @desc: 聚合器工厂
3+ @project: MaxKB
4+ @file: aggregator_factory.py
5+ @date:2026/7/22 16:24
6+ @desc: 聚合器工厂
77"""
8+
89from typing import Dict , Type , Optional
910
11+ from application .workflow .message .aggregator .impl import ProgressAggregator
1012from application .workflow .message .struct .content import Content
13+ from application .workflow .message .struct .progress_content import ProgressContent
1114from application .workflow .message .struct .text_content import TextContent
1215from application .workflow .message .struct .reasoning_content import ReasoningContent
1316from application .workflow .message .struct .tool_content import ToolContent
@@ -22,17 +25,19 @@ class AggregatorFactory:
2225 聚合器工厂
2326 根据内容类型获取对应的聚合器
2427 """
28+
2529 _aggregators : Dict [Type [Content ], ContentAggregator ] = {
2630 TextContent : TextAggregator (),
2731 ReasoningContent : ReasoningAggregator (),
2832 ToolContent : ToolAggregator (),
33+ ProgressContent : ProgressAggregator (),
2934 }
3035
3136 @classmethod
3237 def get_aggregator (cls , content_class : Type [Content ]) -> ContentAggregator :
3338 """
3439 获取聚合器
35-
40+
3641 @param content_class: 内容类型
3742 @return: 聚合器实例
3843 @raises ValueError: 如果找不到对应的聚合器
@@ -46,7 +51,7 @@ def get_aggregator(cls, content_class: Type[Content]) -> ContentAggregator:
4651 def get_aggregator_optional (cls , content_class : Type [Content ]) -> Optional [ContentAggregator ]:
4752 """
4853 获取聚合器(可选)
49-
54+
5055 @param content_class: 内容类型
5156 @return: 聚合器实例或None
5257 """
0 commit comments