mirror of
https://github.com/LifeArchiveProject/WeChatDataAnalysis.git
synced 2026-06-18 15:54:08 +08:00
feat(chat): 支持聊天记录实时更新(WCDB + SSE)
- 新增 WCDB realtime 连接管理与 DLL 依赖,并在 shutdown 释放资源 - 新增实时状态/变更 SSE 与增量同步接口(单会话/全会话) - sessions/messages 支持 source=realtime,增强内容解码与 packed_info md5 提取 - wheel 打包包含 WCDB.dll / wcdb_api.dll
This commit is contained in:
@@ -13,6 +13,7 @@ from .routers.health import router as _health_router
|
||||
from .routers.keys import router as _keys_router
|
||||
from .routers.media import router as _media_router
|
||||
from .routers.wechat_detection import router as _wechat_detection_router
|
||||
from .wcdb_realtime import WCDB_REALTIME, shutdown as _wcdb_shutdown
|
||||
|
||||
# 初始化日志系统
|
||||
setup_logging()
|
||||
@@ -46,6 +47,18 @@ app.include_router(_chat_export_router)
|
||||
app.include_router(_chat_media_router)
|
||||
|
||||
|
||||
@app.on_event("shutdown")
|
||||
async def _shutdown_wcdb_realtime() -> None:
|
||||
try:
|
||||
WCDB_REALTIME.close_all()
|
||||
except Exception:
|
||||
pass
|
||||
try:
|
||||
_wcdb_shutdown()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import uvicorn
|
||||
|
||||
|
||||
Reference in New Issue
Block a user