chore:清理代码,移除不必要的注释和导入,优化日志记录和错误处理

This commit is contained in:
snaily
2025-04-21 13:20:32 +08:00
parent a7085964e8
commit f83f0fa768
13 changed files with 8 additions and 46 deletions

View File

@@ -1,4 +1,3 @@
# app/services/chat/stream_optimizer.py
import asyncio
import math
@@ -107,15 +106,11 @@ class StreamOptimizer:
# 计算智能延迟时间
delay = self.calculate_delay(len(text))
# if self.logger:
# self.logger.info(f"Text length: {len(text)}, delay: {delay:.4f}s")
# 根据文本长度决定输出方式
if len(text) >= self.long_text_threshold:
# 长文本:分块输出
chunks = self.split_text_into_chunks(text)
# if self.logger:
# self.logger.info(f"Long text: splitting into {len(chunks)} chunks")
for chunk_text in chunks:
chunk_response = create_response_chunk(chunk_text)
yield format_chunk(chunk_response)