| 12345678910111213141516171819202122 |
- const fs = require('fs');
- const file = 'src/modules/book-generator/langgraph-generator.ts';
- let content = fs.readFileSync(file, 'utf8');
- // 修复第790行的正则表达式问题
- const old = ` // 移除 <think>...</think> 标签
- const thinkMatch = cleanedStr.match(/</think>([\\s\\S]*)/);
- if (thinkMatch) {
- cleanedStr = thinkMatch[1].trim();
- }`;
- const new_ = ` // 移除思考标签(使用字符串查找)
- const thinkEndIdx = cleanedStr.indexOf('>>>>>>>');
- if (thinkEndIdx !== -1) {
- cleanedStr = cleanedStr.substring(thinkEndIdx + 8).trim();
- }`;
- content = content.replace(old, new_);
- fs.writeFileSync(file, content, 'utf8');
- console.log('✅ 已修复正则表达式问题');
|