creative_studio/backend/scripts/fix_episodes_data.py
hjjjj 5487450f34 feat: 实现审核系统核心功能与UI优化
- 新增审核卡片和确认卡片模型,支持Agent推送审核任务和用户确认
- 实现审核卡片API服务,支持创建、更新、批准、驳回等操作
- 扩展审核维度配置,新增角色一致性、剧情连贯性等维度
- 优化前端审核配置页面,修复API路径错误和状态枚举问题
- 改进剧集创作平台布局,新增左侧边栏用于剧集管理和上下文查看
- 增强Skill管理,支持从审核系统跳转创建/编辑Skill
- 修复episodes.json数据问题,清理聊天历史记录
- 更新Agent提示词,明确Skill引用加载流程
- 统一前端主题配置,优化整体UI体验
2026-01-30 18:32:48 +08:00

68 lines
2.0 KiB
Python

"""
修复episodes.json数据问题
"""
import json
from pathlib import Path
def fix_episodes_data():
"""修复episodes.json中的问题数据"""
episodes_file = Path(__file__).parent.parent / "data" / "episodes.json"
if not episodes_file.exists():
print(f"episodes.json not found at {episodes_file}")
return
with open(episodes_file, 'r', encoding='utf-8') as f:
data = json.load(f)
fixed_count = 0
for episode_id, episode in data.items():
modified = False
# 修复EP1的标题
if episode.get("number") == 1 and episode.get("title") == "11":
episode["title"] = "苏园初会"
modified = True
fixed_count += 1
# 修复EP2的错误内容
if episode.get("number") == 2 and "内容创作失败" in str(episode.get("content", "")):
episode["content"] = ""
episode["status"] = "pending"
modified = True
fixed_count += 1
# 确保所有pending剧集有正确的结构
if episode.get("status") == "pending":
if not episode.get("outline"):
episode["outline"] = None
if not episode.get("content"):
episode["content"] = ""
if not episode.get("structure"):
episode["structure"] = {
"episodeNumber": episode.get("number"),
"scenes": [],
"keyEvents": []
}
modified = True
fixed_count += 1
# 修复qualityScore为None的completed剧集
if episode.get("status") == "completed" and episode.get("qualityScore") is None:
episode["qualityScore"] = 0.0
modified = True
fixed_count += 1
# 保存修复后的数据
with open(episodes_file, 'w', encoding='utf-8') as f:
json.dump(data, f, ensure_ascii=False, indent=2)
print(f"修复完成!共修复 {fixed_count} 个问题")
return True
if __name__ == "__main__":
fix_episodes_data()