新增了完整的流式响应处理模块,包含代码围栏解析、分块策略、指令处理、流式草稿循环等核心能力,支持按段落/句子等规则切割响应块,支持进度更新与指令回调,完善流式交互的全流程支持
72 lines
1.7 KiB
Python
72 lines
1.7 KiB
Python
from yuxi.channel.streaming.block_chunker import (
|
|
BlockChunker,
|
|
BlockReplyCoalescer,
|
|
BreakPreference,
|
|
EmbeddedBlockChunker,
|
|
StreamingBlock,
|
|
)
|
|
from yuxi.channel.streaming.directives import (
|
|
DEFAULT_SILENT_TOKEN,
|
|
DirectiveHandler,
|
|
DirectiveType,
|
|
StreamingDirective,
|
|
StreamingDirectiveParser,
|
|
)
|
|
from yuxi.channel.streaming.draft_stream import (
|
|
DraftStreamLoop,
|
|
FinalizableDraftStreamControls,
|
|
get_tool_status_label,
|
|
)
|
|
from yuxi.channel.streaming.fences import (
|
|
FenceSpan,
|
|
find_fence_span_at,
|
|
is_safe_fence_break,
|
|
parse_fence_spans,
|
|
)
|
|
from yuxi.channel.streaming.models import (
|
|
BlockReplyChunking,
|
|
BlockReplyCoalescing,
|
|
DraftStreamSession,
|
|
DraftStreamState,
|
|
StreamingConfig,
|
|
)
|
|
from yuxi.channel.streaming.progress import (
|
|
ProgressDraftGate,
|
|
ProgressDraftRenderer,
|
|
format_tool_progress_line,
|
|
)
|
|
from yuxi.channel.streaming.strategy_selector import (
|
|
StreamingStrategy,
|
|
StreamingStrategySelector,
|
|
)
|
|
|
|
__all__ = [
|
|
"DraftStreamSession",
|
|
"DraftStreamState",
|
|
"StreamingConfig",
|
|
"BlockReplyChunking",
|
|
"BlockReplyCoalescing",
|
|
"DraftStreamLoop",
|
|
"FinalizableDraftStreamControls",
|
|
"BlockChunker",
|
|
"BlockReplyCoalescer",
|
|
"BreakPreference",
|
|
"EmbeddedBlockChunker",
|
|
"StreamingBlock",
|
|
"FenceSpan",
|
|
"find_fence_span_at",
|
|
"is_safe_fence_break",
|
|
"parse_fence_spans",
|
|
"DEFAULT_SILENT_TOKEN",
|
|
"DirectiveHandler",
|
|
"DirectiveType",
|
|
"StreamingDirective",
|
|
"StreamingDirectiveParser",
|
|
"StreamingStrategy",
|
|
"StreamingStrategySelector",
|
|
"ProgressDraftGate",
|
|
"ProgressDraftRenderer",
|
|
"format_tool_progress_line",
|
|
"get_tool_status_label",
|
|
]
|