test_mvp_enhanced.py•1.4 kB
#!/usr/bin/env python3
"""
测试MVP管理器的增强版状态
"""
from mvp_memory import MVPMemoryManager
def test_mvp_enhanced():
"""测试MVP管理器的增强版状态"""
print("🧪 测试MVP管理器增强版状态...")
# 初始化MVP管理器
mvp = MVPMemoryManager("./mcp_memos_data", use_enhanced=True)
print(f"📊 MVP管理器状态:")
print(f" - use_enhanced: {mvp.use_enhanced}")
print(f" - memory类型: {type(mvp.memory).__name__}")
print(f" - memory模块: {type(mvp.memory).__module__}")
# 检查memory对象的方法
if hasattr(mvp.memory, 'search_memories'):
print(f" - 有search_memories方法: ✅")
else:
print(f" - 没有search_memories方法: ❌")
# 测试添加记忆
print(f"\n🔄 测试添加记忆...")
success = mvp.remember("测试增强版MVP管理器功能", tags=["测试", "增强版"])
print(f"添加记忆结果: {'✅ 成功' if success else '❌ 失败'}")
# 测试检索记忆
print(f"\n🔍 测试检索记忆...")
results = mvp.recall("测试增强版", top_k=3)
print(f"检索结果数量: {len(results)}")
for i, result in enumerate(results, 1):
print(f" {i}. {result.get('content', 'N/A')[:50]}...")
print(f" 分数: {result.get('score', 'N/A')}")
if __name__ == "__main__":
test_mvp_enhanced()