重复预防修复调用路径 | AI生成和翻译

Home 2026.05

你质疑得对。让我追溯一下确切的调用路径:

调用路径 1:Hermes /note 插件 (ww/config/hermes/plugins/note/__init__.py)

# 第143-152行
try:
    file_path = create_note_from_content(text, custom_title=title, directory=note_dir)
except ValueError as e:
    return f"Note rejected: {e}"  # ← 捕获 ValueError

✅ 有错误处理 - 会捕获重复内容的 ValueError

调用路径 2:Research agent (ww/agent/research_agent.py)

# 第108-114行
try:
    file_path = create_note_from_content(content, custom_title=topic)
except Exception as e:
    print(f"Error using create_note_from_content: {str(e)}")  # ← 捕获 Exception

✅ 有错误处理 - 会捕获重复内容的 ValueError

调用路径 3:create_note() (create_note_from_clipboard.py 第101-105行)

def create_note(date=None):
    if check_duplicate_notes():  # ← 第一层检查(剪贴板内容 vs 现有笔记)
        raise ValueError(...)
    content = get_clipboard_content()
    return create_note_from_content(content, date=date)  # ← 第二层检查(我的修复)

✅ 现在有双重保护

总结:

修复是正确的——它正好堵住了之前会创建重复内容的漏洞。


Back Donate