Spaces:
Sleeping
Sleeping
File size: 2,641 Bytes
ee7234a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | """
测试默认内容加载功能
"""
import os
from default_content import get_default_gdl, get_default_prompt, get_default_example_gdl
def test_default_content():
"""测试默认内容是否成功加载"""
print("=" * 60)
print("测试默认内容加载功能")
print("=" * 60)
# 测试 GDL 加载
print("\n📄 测试 GDL 规范加载...")
gdl_content = get_default_gdl()
if gdl_content:
print(f"✅ GDL 规范加载成功")
print(f" - 内容长度: {len(gdl_content)} 字符")
print(f" - 前100个字符: {gdl_content[:100]}...")
else:
print("❌ GDL 规范加载失败")
print(" 请确保 '牌型压制类游戏通用语法.txt' 文件存在")
# 测试 Prompt 加载
print("\n📝 测试 System Prompt 加载...")
prompt_content = get_default_prompt()
if prompt_content:
print(f"✅ System Prompt 加载成功")
print(f" - 内容长度: {len(prompt_content)} 字符")
print(f" - 前100个字符: {prompt_content[:100]}...")
else:
print("❌ System Prompt 加载失败")
print(" 请确保 'prompt.txt' 文件存在")
# 测试示例 GDL 加载
print("\n📋 测试示例 GDL 加载...")
example_gdl_content = get_default_example_gdl()
if example_gdl_content:
print(f"✅ 示例 GDL 加载成功")
print(f" - 内容长度: {len(example_gdl_content)} 字符")
print(f" - 前100个字符: {example_gdl_content[:100]}...")
else:
print("❌ 示例 GDL 加载失败")
print(" 请确保 'ChainBomb_GDL.txt' 文件存在")
# 检查文件是否存在
print("\n📁 检查必需文件...")
gdl_file = "牌型压制类游戏通用语法.txt"
prompt_file = "prompt.txt"
example_gdl_file = "ChainBomb_GDL.txt"
if os.path.exists(gdl_file):
print(f"✅ {gdl_file} 存在")
else:
print(f"❌ {gdl_file} 不存在")
if os.path.exists(prompt_file):
print(f"✅ {prompt_file} 存在")
else:
print(f"❌ {prompt_file} 不存在")
if os.path.exists(example_gdl_file):
print(f"✅ {example_gdl_file} 存在")
else:
print(f"❌ {example_gdl_file} 不存在")
# 总结
print("\n" + "=" * 60)
if gdl_content and prompt_content and example_gdl_content:
print("✅ 所有测试通过!系统可以正常使用默认配置。")
else:
print("⚠️ 部分测试失败,请检查上述错误信息。")
print("=" * 60)
if __name__ == "__main__":
test_default_content()
|