Reapply "【迁移】工具系统再完善:工具缓存、ttl支持、自动记录、长期保存、自动清理缓存、将记录与执行分离、api记录查询、时间聊天工具筛选查询..."

This reverts commit 3d93bc4079.
This commit is contained in:
minecraft1024a
2025-08-27 17:58:18 +08:00
committed by Windpicker-owo
parent 313c7eec17
commit e7fa3d79ff
9 changed files with 604 additions and 168 deletions

View File

@@ -396,13 +396,29 @@ class ExpressionConfig(ValidatedConfigBase):
return None
class ToolHistoryConfig(ValidatedConfigBase):
"""工具历史记录配置类"""
enable_history: bool = True
"""是否启用工具历史记录"""
enable_prompt_history: bool = True
"""是否在提示词中加入工具历史记录"""
max_history: int = 5
"""注入到提示词中的最大工具历史记录数量"""
data_dir: str = "data/tool_history"
"""历史记录保存目录"""
class ToolConfig(ValidatedConfigBase):
"""工具配置类"""
enable_tool: bool = Field(default=False, description="启用工具")
history: ToolHistoryConfig = Field(default_factory=ToolHistoryConfig)
"""工具历史记录配置"""
class VoiceConfig(ValidatedConfigBase):
"""语音识别配置类"""