优化消息管理

This commit is contained in:
LuiKlee
2025-12-13 20:19:11 +08:00
parent 6af9780ff6
commit 9a0163d06b
6 changed files with 405 additions and 74 deletions

View File

@@ -6,8 +6,6 @@
import asyncio
import time
from typing import Any
from unittest.mock import AsyncMock, MagicMock, patch
class PerformanceBenchmark:
@@ -20,7 +18,7 @@ class PerformanceBenchmark:
"""测试查询去重性能"""
# 这里需要导入实际的管理器
# from src.memory_graph.unified_manager import UnifiedMemoryManager
test_cases = [
{
"name": "small_queries",
@@ -67,7 +65,7 @@ class PerformanceBenchmark:
seen = set()
decay = 0.15
manual_queries = []
for raw in queries:
text = (raw or "").strip()
if text and text not in seen:
@@ -192,7 +190,7 @@ class PerformanceBenchmark:
mem_id = mem.get("id")
else:
mem_id = getattr(mem, "id", None)
if mem_id and mem_id in seen_ids:
continue
unique_memories.append(mem)