| 123456789101112131415161718192021222324 |
- """测试API返回的template_body"""
- import requests
- API_BASE = "http://localhost:8000/api"
- # 获取所有模板
- response = requests.get(f"{API_BASE}/templates")
- templates = response.json()
- print(f"总模板数: {len(templates)}")
- print()
- # 检查第一个模板
- if templates:
- tpl = templates[0]
- print(f"模板ID: {tpl.get('id')}")
- print(f"机型: {tpl.get('machine_model')}")
- print(f"类型: {tpl.get('template_type')}")
- print(f"has template_body: {'template_body' in tpl}")
- print(f"template_body类型: {type(tpl.get('template_body'))}")
- print(f"template_body长度: {len(str(tpl.get('template_body', '')))}")
- print()
- print("template_body前200字符:")
- print(str(tpl.get('template_body', ''))[:200])
|