fix: template
This commit is contained in:
parent
8047701388
commit
d27a458f6b
|
|
@ -699,6 +699,13 @@ PostgreSQL 驱动 psycopg2 未安装。请安装:
|
||||||
draft_content = row.get('draft_content', {})
|
draft_content = row.get('draft_content', {})
|
||||||
if isinstance(draft_content, dict):
|
if isinstance(draft_content, dict):
|
||||||
template_info.draft_content = draft_content
|
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:
|
else:
|
||||||
template_info.draft_content = {}
|
template_info.draft_content = {}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue