From 111909c26db24d8238c85458e7d6045a9cff7524 Mon Sep 17 00:00:00 2001 From: Sakura-RanChen <1908198662@qq.com> Date: Fri, 9 Jan 2026 15:46:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=90=AF=E7=94=A8=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E7=94=BB=E5=83=8F=E6=A8=A1=E5=BC=8F=E6=97=B6=EF=BC=8Csearch?= =?UTF-8?q?=E4=B8=BA=E5=90=8C=E6=AD=A5=E6=96=B9=E6=B3=95=E9=9C=80=E5=8C=85?= =?UTF-8?q?=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../providers/memory/powermem/powermem.py | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/main/xiaozhi-server/core/providers/memory/powermem/powermem.py b/main/xiaozhi-server/core/providers/memory/powermem/powermem.py index a92b8ab3..c33c58da 100644 --- a/main/xiaozhi-server/core/providers/memory/powermem/powermem.py +++ b/main/xiaozhi-server/core/providers/memory/powermem/powermem.py @@ -230,11 +230,21 @@ class MemoryProvider(MemoryProviderBase): result_parts.append(f"【用户画像】\n{profile}") # Search memories using PowerMem SDK - results = await self.memory_client.search( - query=query, - user_id=self.role_id, - limit=30 - ) + if self.enable_user_profile: + # UserMemory uses sync search + results = await asyncio.to_thread( + self.memory_client.search, + query=query, + user_id=self.role_id, + limit=30 + ) + else: + # AsyncMemory uses async search + results = await self.memory_client.search( + query=query, + user_id=self.role_id, + limit=30 + ) if results and "results" in results: # Format each memory entry with its update time