mirror of
https://gitcode.com/JianFeeeee/TrulyMEM-TrueHumanMEM.git
synced 2026-10-15 12:15:32 +00:00
fix: 简化清空逻辑 - 空消息列表即清空
This commit is contained in:
@ -78,7 +78,7 @@ class BackendClient:
|
|||||||
packet = Packet(
|
packet = Packet(
|
||||||
id=self._next_id(),
|
id=self._next_id(),
|
||||||
type=PacketType.SAVE_HISTORY,
|
type=PacketType.SAVE_HISTORY,
|
||||||
body={"messages": [{"action": "clear"}]}
|
body={"messages": []}
|
||||||
)
|
)
|
||||||
return self._server.send(packet).body
|
return self._server.send(packet).body
|
||||||
|
|
||||||
|
|||||||
@ -345,7 +345,7 @@ class BackendServer:
|
|||||||
|
|
||||||
def _handle_save_history(self, body: Dict) -> Dict:
|
def _handle_save_history(self, body: Dict) -> Dict:
|
||||||
messages = body.get("messages", [])
|
messages = body.get("messages", [])
|
||||||
if messages and messages[0].get("action") == "clear":
|
if not messages:
|
||||||
self._graph.clear_chat_records()
|
self._graph.clear_chat_records()
|
||||||
return {"status": "history_cleared"}
|
return {"status": "history_cleared"}
|
||||||
result = self._graph.save_chat_records(messages)
|
result = self._graph.save_chat_records(messages)
|
||||||
|
|||||||
Reference in New Issue
Block a user