mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-29 06:53:56 +08:00
fix: 启用用户画像模式时,search为同步方法需包装
This commit is contained in:
@@ -230,11 +230,21 @@ class MemoryProvider(MemoryProviderBase):
|
|||||||
result_parts.append(f"【用户画像】\n{profile}")
|
result_parts.append(f"【用户画像】\n{profile}")
|
||||||
|
|
||||||
# Search memories using PowerMem SDK
|
# Search memories using PowerMem SDK
|
||||||
results = await self.memory_client.search(
|
if self.enable_user_profile:
|
||||||
query=query,
|
# UserMemory uses sync search
|
||||||
user_id=self.role_id,
|
results = await asyncio.to_thread(
|
||||||
limit=30
|
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:
|
if results and "results" in results:
|
||||||
# Format each memory entry with its update time
|
# Format each memory entry with its update time
|
||||||
|
|||||||
Reference in New Issue
Block a user