refactor: consolidate stream smoothing into StreamProcessor with intelligent timing

- Move StreamSmoother functionality directly into StreamProcessor for better integration
- Create ContentExtractor strategy pattern for format-agnostic content extraction
- Implement intelligent dynamic delay calculation based on text length
- Support three text length tiers: short (char-by-char), medium (chunked), long (chunked)
- Remove manual chunk_size and delay_ms configuration - now auto-calculated
- Simplify admin UI to single toggle switch with auto timing adjustment
- Extract format detection logic to reusable content_extractors module
- Improve code maintainability with cleaner architecture
This commit is contained in:
fawney19
2025-12-19 09:46:22 +08:00
parent 85fafeacb8
commit 070121717d
7 changed files with 600 additions and 360 deletions

View File

@@ -81,15 +81,7 @@ class SystemConfigService:
# 流式平滑输出配置
"stream_smoothing_enabled": {
"value": False,
"description": "是否启用流式平滑输出,将大 chunk 拆分成小块模拟打字效果",
},
"stream_smoothing_chunk_size": {
"value": 5,
"description": "流式平滑输出每个小块的字符数",
},
"stream_smoothing_delay_ms": {
"value": 15,
"description": "流式平滑输出每个小块之间的延迟毫秒数",
"description": "是否启用流式平滑输出,自动根据文本长度调整输出速度",
},
}