可选是否向提示词插入工具历史

pull/1185/head
Windpicker-owo 2025-08-18 02:50:00 +08:00
parent be860744e6
commit b53f728086
3 changed files with 9 additions and 0 deletions

View File

@ -25,6 +25,11 @@ def get_tool_history_prompt(message_id: Optional[str] = None) -> str:
Returns:
格式化的工具历史提示词
"""
from src.config.config import global_config
if not global_config.tool.history.enable_prompt_history:
return ""
return tool_history_manager.get_recent_history_prompt(
chat_id=message_id
)

View File

@ -289,6 +289,9 @@ class ToolHistoryConfig(ConfigBase):
enable_history: bool = True
"""是否启用工具历史记录"""
enable_prompt_history: bool = True
"""是否在提示词中加入工具历史记录"""
max_history: int = 100
"""历史记录最大保存数量"""

View File

@ -116,6 +116,7 @@ enable_tool = false # 是否在普通聊天中启用工具
[tool.history]
enable_history = true # 是否启用工具调用历史记录
enable_prompt_history = true # 是否在提示词中加入工具历史记录
max_history = 5 # 每个会话最多保留的历史记录数
[mood]