feat: 添加数据库迁移、清空聊天记录按钮 - 复用SAVE_HISTORY接口

This commit is contained in:
root
2026-04-15 11:07:06 +08:00
parent adc7857344
commit b86610d445
6 changed files with 73 additions and 13 deletions

View File

@ -345,9 +345,12 @@ class BackendServer:
def _handle_save_history(self, body: Dict) -> Dict:
messages = body.get("messages", [])
if messages and messages[0].get("action") == "clear":
self._graph.clear_chat_records()
return {"status": "history_cleared"}
result = self._graph.save_chat_records(messages)
return {"status": "history_saved"}
def _send_response(self, request_id: str, response: PacketResponse) -> None:
with self._lock:
q = self._response_queues.pop(request_id, None)