mirror of
https://github.com/agentscope-ai/ReMe.git
synced 2026-10-06 02:48:22 +00:00
- 新增 AddProfile 工具类用于添加用户配置文件 - 新增 DeleteProfile 工具类用于删除指定ID的配置文件 - 从 __init__.py 中移除已废弃的 UpdateProfileFilterOlder 工具 - 在 reme.py 中注释掉 AddProfile 和 DeleteProfile 的导入 - 从 reme.py 的工具列表中移除 UpdateProfileFilterOlder 相关代码 - 优化 ES 和 Qdrant 向量存储客户端初始化的日志记录 - 更新个人记忆检索器和摘要器的 YAML 配置文件格式 - 修复 personal_halumem_summarizer.py 中的参数传递格式问题 - 在 UpdateProfile 工具中添加按 memory_target 分组的功能
53 lines
1.7 KiB
Python
53 lines
1.7 KiB
Python
"""Delete user profile tool"""
|
|
|
|
from loguru import logger
|
|
|
|
from .profile_handler import ProfileHandler
|
|
from ..base_memory_tool import BaseMemoryTool
|
|
from ....core.schema import ToolCall
|
|
|
|
|
|
class DeleteProfile(BaseMemoryTool):
|
|
"""Tool to delete a single profile entry by ID"""
|
|
|
|
def __init__(self, **kwargs):
|
|
super().__init__(**kwargs)
|
|
|
|
def _build_tool_call(self) -> ToolCall:
|
|
"""Build and return the tool call schema"""
|
|
return ToolCall(
|
|
**{
|
|
"description": "Delete a profile entry by profile ID.",
|
|
"parameters": {
|
|
"type": "object",
|
|
"properties": {
|
|
"profile_id": {
|
|
"type": "string",
|
|
"description": "The unique ID of the profile to delete.",
|
|
},
|
|
},
|
|
"required": ["profile_id"],
|
|
},
|
|
},
|
|
)
|
|
|
|
async def execute(self):
|
|
profile_handler = ProfileHandler(profile_path=self.profile_path, memory_target=self.memory_target)
|
|
|
|
# Get profile_id parameter
|
|
profile_id = self.context.get("profile_id", "")
|
|
|
|
if not profile_id:
|
|
return "No profile_id provided, operation cancelled."
|
|
|
|
# Delete profile using ProfileHandler
|
|
success = profile_handler.delete(profile_id)
|
|
|
|
if success:
|
|
output = f"Successfully deleted profile with ID: {profile_id}"
|
|
logger.info(output)
|
|
return output
|
|
else:
|
|
output = f"Profile with ID '{profile_id}' not found."
|
|
logger.warning(output)
|
|
return output
|