修改引用逻辑,修改长期记忆bug
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
# app/prompts.py
|
||||
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
|
||||
from langchain_core.tools import BaseTool
|
||||
|
||||
def create_system_prompt(tools: list = None) -> ChatPromptTemplate:
|
||||
"""
|
||||
@@ -11,7 +10,7 @@ def create_system_prompt(tools: list = None) -> ChatPromptTemplate:
|
||||
tool_descs = []
|
||||
for tool in tools:
|
||||
# 提取工具名称和描述的第一行
|
||||
name = getattr(tool, 'name', tool.__name__)
|
||||
name = getattr(tool, 'name', None) or getattr(tool, '__name__', 'unknown_tool')
|
||||
desc = (tool.description or "").split('\n')[0]
|
||||
tool_descs.append(f"- {name}: {desc}")
|
||||
tools_section = "\n".join(tool_descs)
|
||||
|
||||
Reference in New Issue
Block a user