Files
jiaowu-test/fix_resume_structure.py
KQL 1b964b3886 chore: 更新数据文件和组件优化
主要更新内容:
- 优化UI组件(视频播放器、HR访问模态框、岗位信息展示等)
- 更新数据文件(简历、岗位、项目案例等)
- 添加新的图片资源(面试状态图标等)
- 新增AgentPage等页面组件
- 清理旧的备份文件,提升代码库整洁度
- 优化岗位等级和面试状态的数据结构

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-15 15:55:25 +08:00

50 lines
1.7 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import re
# 读取文件
with open('src/mocks/resumeInterviewMock.js', 'r', encoding='utf-8') as f:
content = f.read()
# 查找有问题的结构:在 ], 后面直接跟着 compound_skills: [
# 这种结构破坏了JSON格式需要删除
pattern = r'(\s*\]\s*,)\s*compound_skills:\s*\[[^\]]*?\],\s*personal_summary:\s*"[^"]*?"\s*\}\s*\}\s*\],\s*("(?:新媒体运营|文旅产品设计|品牌运营|旅游)":\s*\[)'
def fix_structure(match):
# 保留第一个 ], 和后面正确的行业开始
return match.group(1) + '\n ' + match.group(2)
# 使用更精确的模式
# 匹配露营地运营后面的多余部分
pattern1 = r'( \}\s*\}\s*\],)\s*compound_skills:\s*\[[^\]]*?\],\s*personal_summary:\s*"[^"]*?"\s*\}\s*\}\s*\],\s*("新媒体运营":\s*\[)'
content = re.sub(pattern1, r'\1\n \2', content)
# 查找并修复其他类似的问题
# 匹配任何在 }] 后面跟着 compound_skills 的情况
pattern2 = r'(\}\s*\]\s*,)\s*compound_skills:\s*\[[^\[]*?\],\s*(?="[^"]+":)'
count = 0
while True:
new_content = re.sub(pattern2, r'\1\n ', content)
if new_content == content:
break
content = new_content
count += 1
print(f"修复了第 {count} 处问题")
# 写回文件
with open('src/mocks/resumeInterviewMock.js', 'w', encoding='utf-8') as f:
f.write(content)
print(f"✅ 修复完成,共修复了 {count} 处结构问题")
# 验证文件语法
import subprocess
result = subprocess.run(['node', '-c', 'src/mocks/resumeInterviewMock.js'],
capture_output=True, text=True)
if result.returncode == 0:
print("✅ 文件语法验证通过")
else:
print(f"❌ 文件仍有语法错误:\n{result.stderr}")