Simford.Dong commited on
Commit ·
f5c4d74
1
Parent(s): dab9dfe
Include WeChat account files in backup/restore
Browse filesAdds /data/.hermes/weixin/ to the backup path mapping so WeChat
session tokens (context-tokens.json, sync.json) persist across restarts.
- src/data_sync.py +7 -0
src/data_sync.py
CHANGED
|
@@ -60,6 +60,7 @@ class DatasetManager:
|
|
| 60 |
'webui_dir': {'path': Path('/data/.hermes-web-ui'), 'skip_backup': False},
|
| 61 |
'image_cache': {'path': self.hermes_home / 'image_cache', 'skip_backup': True}, # 图片缓存大
|
| 62 |
'baoyu_skills': {'path': Path('/home/appuser/.baoyu-skills'), 'skip_backup': False},
|
|
|
|
| 63 |
}
|
| 64 |
|
| 65 |
def validate(self) -> bool:
|
|
@@ -254,6 +255,11 @@ class DatasetManager:
|
|
| 254 |
if not webui_info.get('skip_backup') and webui_info['path'].exists():
|
| 255 |
shutil.copytree(webui_info['path'], self.temp_dir / 'webui', dirs_exist_ok=True)
|
| 256 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 257 |
# 确保空目录也能被 git/HF dataset 跟踪(git 不跟踪空目录)
|
| 258 |
for subdir in ['memories', 'skills', 'sessions', 'cron', 'baoyu_skills']:
|
| 259 |
dirpath = self.temp_dir / subdir
|
|
@@ -385,6 +391,7 @@ class DatasetManager:
|
|
| 385 |
'webui': self.path_mapping['webui_dir']['path'],
|
| 386 |
'image_cache': self.path_mapping['image_cache']['path'],
|
| 387 |
'baoyu_skills': self.path_mapping['baoyu_skills']['path'],
|
|
|
|
| 388 |
}
|
| 389 |
|
| 390 |
if not skip_restore:
|
|
|
|
| 60 |
'webui_dir': {'path': Path('/data/.hermes-web-ui'), 'skip_backup': False},
|
| 61 |
'image_cache': {'path': self.hermes_home / 'image_cache', 'skip_backup': True}, # 图片缓存大
|
| 62 |
'baoyu_skills': {'path': Path('/home/appuser/.baoyu-skills'), 'skip_backup': False},
|
| 63 |
+
'weixin': {'path': self.hermes_home / 'weixin', 'skip_backup': False},
|
| 64 |
}
|
| 65 |
|
| 66 |
def validate(self) -> bool:
|
|
|
|
| 255 |
if not webui_info.get('skip_backup') and webui_info['path'].exists():
|
| 256 |
shutil.copytree(webui_info['path'], self.temp_dir / 'webui', dirs_exist_ok=True)
|
| 257 |
|
| 258 |
+
# WeChat 会话凭据
|
| 259 |
+
weixin_info = self.path_mapping['weixin']
|
| 260 |
+
if not weixin_info.get('skip_backup') and weixin_info['path'].exists():
|
| 261 |
+
shutil.copytree(weixin_info['path'], self.temp_dir / 'weixin', dirs_exist_ok=True)
|
| 262 |
+
|
| 263 |
# 确保空目录也能被 git/HF dataset 跟踪(git 不跟踪空目录)
|
| 264 |
for subdir in ['memories', 'skills', 'sessions', 'cron', 'baoyu_skills']:
|
| 265 |
dirpath = self.temp_dir / subdir
|
|
|
|
| 391 |
'webui': self.path_mapping['webui_dir']['path'],
|
| 392 |
'image_cache': self.path_mapping['image_cache']['path'],
|
| 393 |
'baoyu_skills': self.path_mapping['baoyu_skills']['path'],
|
| 394 |
+
'weixin': self.path_mapping['weixin']['path'],
|
| 395 |
}
|
| 396 |
|
| 397 |
if not skip_restore:
|