fix: template

This commit is contained in:
root 2025-07-12 23:43:22 +08:00
parent 8047701388
commit d27a458f6b
1 changed files with 7 additions and 0 deletions

View File

@ -699,6 +699,13 @@ PostgreSQL 驱动 psycopg2 未安装。请安装:
draft_content = row.get('draft_content', {})
if isinstance(draft_content, dict):
template_info.draft_content = draft_content
elif isinstance(draft_content, str):
# 如果是字符串,尝试解析为 JSON
try:
template_info.draft_content = json.loads(draft_content)
except (json.JSONDecodeError, TypeError):
logger.warning(f"Failed to parse draft_content JSON for template {row['id']}: {draft_content}")
template_info.draft_content = {}
else:
template_info.draft_content = {}