const fs = require('fs');
const file = 'src/modules/book-generator/langgraph-generator.ts';
const lines = fs.readFileSync(file, 'utf8').split('\n');

// 删除第790行（重复的 searchTag）
lines.splice(789, 1);

// 在第793行后添加缺失的 }
// 现在第793行是: cleanedStr = cleanedStr.substring(thinkEndIdx + searchTag.length).trim();
// 需要在它后面加 }
lines.splice(793, 0, '    }');

fs.writeFileSync(file, lines.join('\n'), 'utf8');
console.log('✅ 修复完成');
console.log('第789-795行:');
for (let i = 788; i <= 794; i++) {
  console.log(`${i+1}: ${lines[i]}`);
}
