feat:优化流式输出,增加临时多轮对话记录

This commit is contained in:
2026-09-29 09:55:17 -07:00
parent 6a38a5f15e
commit a89a458c22
10 changed files with 153 additions and 23 deletions
+13
View File
@@ -50,7 +50,20 @@ class Settings:
default_factory=lambda: int(os.getenv("MAX_ACTION_RETRIES", "2"))
)
# 没有任何对话的空会话保留时长(秒),超时后视为不存在
conversation_empty_ttl: int = field(
default_factory=lambda: int(os.getenv("CONVERSATION_EMPTY_TTL", "7200"))
)
# 每次请求带入模型的最近对话轮数
conversation_history_turns: int = field(
default_factory=lambda: int(os.getenv("CONVERSATION_HISTORY_TURNS", "6"))
)
def __post_init__(self):
if self.conversation_empty_ttl <= 0:
raise ValueError("CONVERSATION_EMPTY_TTL 必须是正整数")
if self.conversation_history_turns < 0:
raise ValueError("CONVERSATION_HISTORY_TURNS 必须是非负整数")
if type(self.max_action_retries) is not int or self.max_action_retries < 0:
raise ValueError("MAX_ACTION_RETRIES 必须是非负整数")
if not 0 <= self.intent_min_confidence <= 1: