feat:完成重构和测试
This commit is contained in:
+8
-2
@@ -58,9 +58,13 @@ class Settings:
|
||||
conversation_empty_ttl: int = field(
|
||||
default_factory=lambda: int(os.getenv("CONVERSATION_EMPTY_TTL", "7200"))
|
||||
)
|
||||
# 每次请求带入模型的最近对话轮数
|
||||
# 每次请求从会话记录读取的最近轮数上限,实际带入多少由 history_max_tokens 决定
|
||||
conversation_history_turns: int = field(
|
||||
default_factory=lambda: int(os.getenv("CONVERSATION_HISTORY_TURNS", "6"))
|
||||
default_factory=lambda: int(os.getenv("CONVERSATION_HISTORY_TURNS", "20"))
|
||||
)
|
||||
# 每次请求带入的会话历史 token 预算(近似计数),从最近一轮往前保留完整的轮次
|
||||
history_max_tokens: int = field(
|
||||
default_factory=lambda: int(os.getenv("HISTORY_MAX_TOKENS", "4096"))
|
||||
)
|
||||
|
||||
# MongoDB 连接串,未配置时会话记录和检查点回退为进程内存实现
|
||||
@@ -107,6 +111,8 @@ class Settings:
|
||||
raise ValueError("CONVERSATION_EMPTY_TTL 必须是正整数")
|
||||
if self.conversation_history_turns < 0:
|
||||
raise ValueError("CONVERSATION_HISTORY_TURNS 必须是非负整数")
|
||||
if self.history_max_tokens < 1:
|
||||
raise ValueError("HISTORY_MAX_TOKENS 必须是正整数")
|
||||
if self.max_agent_steps < 1:
|
||||
raise ValueError("MAX_AGENT_STEPS 必须是正整数")
|
||||
if self.mcp_tool_timeout <= 0:
|
||||
|
||||
Reference in New Issue
Block a user