Files
SillyTavern_replica/check_worldbook_path.py
2026-05-01 15:44:14 +08:00

50 lines
1.5 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""
检查世界书路径和文件
"""
from pathlib import Path
# 项目根目录
PROJECT_ROOT = Path(r'D:\progarm\python\llm_workflow_engine')
DATA_PATH = PROJECT_ROOT / 'data'
WORLDBOOKS_PATH = DATA_PATH / 'worldbooks'
print("=" * 60)
print("世界书路径检查")
print("=" * 60)
print(f"\n1. 项目根目录: {PROJECT_ROOT}")
print(f" 存在: {PROJECT_ROOT.exists()}")
print(f"\n2. 数据目录: {DATA_PATH}")
print(f" 存在: {DATA_PATH.exists()}")
print(f"\n3. 世界书目录: {WORLDBOOKS_PATH}")
print(f" 存在: {WORLDBOOKS_PATH.exists()}")
if WORLDBOOKS_PATH.exists():
json_files = list(WORLDBOOKS_PATH.glob("*.json"))
print(f" JSON文件数量: {len(json_files)}")
if json_files:
print(f" 文件列表:")
for f in json_files:
print(f" - {f.name} ({f.stat().st_size} bytes)")
else:
print(f" ⚠️ 世界书目录为空没有JSON文件")
# 检查目录下是否有子目录
subdirs = list(WORLDBOOKS_PATH.iterdir())
if subdirs:
print(f" 子目录/文件:")
for item in subdirs:
print(f" - {item.name} ({'目录' if item.is_dir() else '文件'})")
else:
print(f" ❌ 世界书目录不存在!")
# 检查data目录下有什么
if DATA_PATH.exists():
print(f"\n4. data目录内容:")
for item in DATA_PATH.iterdir():
print(f" - {item.name} ({'目录' if item.is_dir() else '文件'})")
print("\n" + "=" * 60)