应用层memory_content->memory_config
This commit is contained in:
@@ -51,7 +51,7 @@ class ToolOldConfig(BaseModel):
|
||||
class MemoryConfig(BaseModel):
|
||||
"""记忆配置"""
|
||||
enabled: bool = Field(default=True, description="是否启用对话历史记忆")
|
||||
memory_content: Optional[str] = Field(default=None, description="选择记忆的内容类型")
|
||||
memory_config: Optional[str] = Field(default=None, description="选择记忆的内容类型")
|
||||
max_history: int = Field(default=10, ge=0, le=100, description="最大保留的历史对话轮数")
|
||||
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ def create_long_term_memory_tool(memory_config: Dict[str, Any], end_user_id: str
|
||||
长期记忆工具
|
||||
"""
|
||||
# search_switch = memory_config.get("search_switch", "2")
|
||||
config_id= memory_config.get("memory_content",None)
|
||||
config_id= memory_config.get("memory_content") or memory_config.get("memory_config",None)
|
||||
logger.info(f"创建长期记忆工具,配置: end_user_id={end_user_id}, config_id={config_id}, storage_type={storage_type}")
|
||||
@tool(args_schema=LongTermMemoryInput)
|
||||
def long_term_memory(question: str) -> str:
|
||||
@@ -106,9 +106,9 @@ def create_long_term_memory_tool(memory_config: Dict[str, Any], end_user_id: str
|
||||
"app.core.memory.agent.read_message",
|
||||
args=[end_user_id, question, [], "1", config_id, storage_type, user_rag_memory_id]
|
||||
)
|
||||
# result = task_service.get_task_memory_read_result(task.id)
|
||||
# status = result.get("status")
|
||||
# logger.info(f"读取任务状态:{status}")
|
||||
result = task_service.get_task_memory_read_result(task.id)
|
||||
status = result.get("status")
|
||||
logger.info(f"读取任务状态:{status}")
|
||||
|
||||
finally:
|
||||
db.close()
|
||||
@@ -418,7 +418,7 @@ class DraftRunService:
|
||||
)
|
||||
|
||||
memory_config_= agent_config.memory
|
||||
config_id = memory_config_.get("memory_content")
|
||||
config_id = memory_config_.get("memory_content") or memory_config_.get("memory_config",None)
|
||||
|
||||
# 7. 调用 Agent
|
||||
result = await agent.chat(
|
||||
@@ -644,7 +644,7 @@ class DraftRunService:
|
||||
})
|
||||
|
||||
memory_config_ = agent_config.memory
|
||||
config_id = memory_config_.get("memory_content")
|
||||
config_id = memory_config_.get("memory_content") or memory_config_.get("memory_config",None)
|
||||
|
||||
# 9. 流式调用 Agent
|
||||
full_content = ""
|
||||
|
||||
Reference in New Issue
Block a user