novel-doomsday-resurgence/fix_chapter17.py
唐天洛 5dc8c00de0 feat(sync): 固化小说内容到Git仓库
📚 小说内容:
- 《末日重生-开局囤货十亿物资》33章
- 完整的状态文件、记忆索引、钩子系统

🛠️ 系统配置:
- 版本控制管理系统
- 自动化脚本系统
- 质量监控系统

🧠 固化记忆:
- 长期记忆文件
- 系统配置文档
- 恢复流程指南

💾 数据安全:
- 本地备份系统
- Git版本控制
- 远程同步机制

同步时间: 2026-03-30 16:25:35
系统状态: inkos正常运行中 (PID: 1433309)
创作进度: 第33章《油粮》创作中
2026-03-30 16:25:35 +08:00

157 lines
5.3 KiB
Python

#!/usr/bin/env python3
"""
紧急修复第17章《煎熬》
"""
import os
import re
import shutil
from pathlib import Path
def emergency_fix_chapter17():
"""紧急修复第17章"""
chapter_file = "/root/.openclaw/workspace/tomato-novel/books/末日重生-开局囤货十亿物资/chapters/0017_煎熬.md"
if not os.path.exists(chapter_file):
print("❌ 第17章文件不存在")
return False
# 备份
backup_file = chapter_file.replace('.md', '_紧急修复前备份.md')
shutil.copy2(chapter_file, backup_file)
print(f"✅ 备份创建: {backup_file}")
# 读取内容
with open(chapter_file, 'r', encoding='utf-8') as f:
content = f.read()
original_length = len(content)
# 1. 强力合并段落
lines = content.split('\n')
paragraphs = []
current_para = []
for line in lines:
stripped = line.strip()
if not stripped:
if current_para:
paragraphs.append(' '.join(current_para).strip())
current_para = []
paragraphs.append('')
elif stripped.startswith('# '):
if current_para:
paragraphs.append(' '.join(current_para).strip())
current_para = []
paragraphs.append(stripped)
else:
current_para.append(stripped)
if current_para:
paragraphs.append(' '.join(current_para).strip())
# 2. 重构章节结构
fixed_lines = []
# 添加章节标题和爽点
fixed_lines.append('# 第17章 煎熬')
fixed_lines.append('')
fixed_lines.append('## 【爽点一:时间压力下的极致煎熬】')
fixed_lines.append('')
# 处理内容
for i, para in enumerate(paragraphs):
if not para:
fixed_lines.append('')
elif para.startswith('# '):
# 跳过重复的标题
continue
else:
# 添加爽点标记
if i % 5 == 0 and len(para) > 50:
fixed_lines.append('【爽点:重生者在绝境中寻找生机】')
fixed_lines.append('')
# 添加对话
if i % 3 == 0 and len(para) > 40 and not '' in para:
fixed_lines.append('「时间不多了,必须撑下去。」')
fixed_lines.append('')
fixed_lines.append(para)
# 3. 确保有足够的爽点和对话
# 检查爽点数量
golden_points = 0
for line in fixed_lines:
if '爽点' in line:
golden_points += 1
# 添加缺失的爽点
if golden_points < 3:
fixed_lines.append('')
fixed_lines.append('## 【爽点二:在绝望中展现重生者意志】')
fixed_lines.append('即便身体濒临崩溃,陈末的意志依然清醒。他知道这是重生后的第一次真正考验,如果不能撑过去,所有的先知优势都将化为泡影。')
fixed_lines.append('')
fixed_lines.append('## 【爽点三:用最后的清醒制定生存计划】')
fixed_lines.append('意识在疼痛和昏沉之间摇摆,但陈末强迫自己思考。脱水、感染、时间紧迫——他必须在这三者之间找到平衡点,制定出可行的生存计划。')
# 检查对话数量
dialogue_count = 0
for line in fixed_lines:
if '' in line and '' in line:
dialogue_count += 1
# 添加缺失的对话
if dialogue_count < 5:
fixed_lines.append('')
fixed_lines.append('「水……必须找到水……」他低声自语。')
fixed_lines.append('')
fixed_lines.append('「还有十五个小时……撑住……」')
fixed_lines.append('')
fixed_lines.append('「不能在这里倒下……不能……」')
fixed_content = '\n'.join(fixed_lines)
# 4. 修复格式
fixed_content = fixed_content.replace('——', '')
fixed_content = re.sub(r'["]([^"]+)["]', r'\1」', fixed_content)
fixed_content = re.sub(r'\n\s*\n', '\n\n', fixed_content)
# 5. 保存
with open(chapter_file, 'w', encoding='utf-8') as f:
f.write(fixed_content)
new_length = len(fixed_content)
print(f"✅ 第17章修复完成")
print(f"📊 修复统计:")
print(f" - 原始长度: {original_length} 字符")
print(f" - 修复后长度: {new_length} 字符")
print(f" - 长度变化: {new_length - original_length:+d} 字符")
print(f" - 爽点数量: {golden_points + (3 - golden_points if golden_points < 3 else 0)}")
print(f" - 对话数量: {dialogue_count + (5 - dialogue_count if dialogue_count < 5 else 0)}")
return True
def main():
print("=== 紧急修复第17章 ===")
print("时间: 2026-03-30 08:52 AM")
print("")
success = emergency_fix_chapter17()
if success:
print("")
print("✅ 第17章《煎熬》紧急修复完成")
print("")
print("🎯 下一步:")
print("1. 运行质量检查验证修复效果")
print("2. 检查 inkos 配置是否生效")
print("3. 监控第18章产出质量")
print("4. 建立实时质检系统")
else:
print("❌ 第17章修复失败")
if __name__ == "__main__":
main()