详细说明: - 删除web_result下的3个冗余文件夹(会展策划/Agent_prompt/agent头像) - 所有资源已整合到订单班文档资料/文旅目录 - 更新11个文件中的122处路径引用 - 修复wenlu.ts的TypeScript类型声明 - 添加AgentOutput类型导入 影响文件: - web_result/index.html (30处路径更新) - web_result/order-classes/wenlu/*.html (62处更新) - web_result/js/router.js (1处更新) - exhibition-demo/src/data/terminalSimulations/wenlu.ts (类型修复) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
115 lines
3.4 KiB
Python
115 lines
3.4 KiB
Python
#!/usr/bin/env python3
|
||
# -*- coding: utf-8 -*-
|
||
"""
|
||
大健康订单班图片重命名和markdown引用更新脚本
|
||
"""
|
||
import os
|
||
import re
|
||
import shutil
|
||
|
||
# 配置路径
|
||
BASE_PATH = "/Users/xiaoqi/Documents/Dev/Project/2025-09-08_n8nDEMO演示/web_frontend/exhibition-demo/public/data/订单班文档资料/大健康/notion文稿"
|
||
IMAGE_DIR = os.path.join(BASE_PATH, "image")
|
||
MD_FILE = os.path.join(BASE_PATH, "心理咨询服务全流程方案 27a118168b2380509c37d8d98254d437.md")
|
||
|
||
# 图片名称映射(根据markdown中的描述)
|
||
IMAGE_MAPPING = {
|
||
"7aa0c0c006039f0efc89051f40a0c88e.jpeg": "情绪数据分析表.jpg",
|
||
"b79f36cc235db43e1d5425e6836bc243.jpeg": "心理状态结构化分析示意图.jpg",
|
||
"f4c03e131c23619d4eef4d17f0b2f6c6.jpeg": "目标设定可视化示意图.jpg",
|
||
"d9c361a9040605261b013b3b3a7efb68.jpeg": "干预方法选择示意图.jpg",
|
||
"79c78e1bc51605b526690061fa893e62.jpeg": "临床心理结案报告.jpg"
|
||
}
|
||
|
||
def rename_images():
|
||
"""重命名图片文件"""
|
||
print("=" * 60)
|
||
print("开始重命名图片文件...")
|
||
print("=" * 60)
|
||
|
||
for old_name, new_name in IMAGE_MAPPING.items():
|
||
old_path = os.path.join(IMAGE_DIR, old_name)
|
||
new_path = os.path.join(IMAGE_DIR, new_name)
|
||
|
||
if os.path.exists(old_path):
|
||
shutil.move(old_path, new_path)
|
||
print(f"✅ {old_name} -> {new_name}")
|
||
else:
|
||
print(f"⚠️ 文件不存在: {old_name}")
|
||
|
||
print("\n图片重命名完成!\n")
|
||
|
||
def update_markdown():
|
||
"""更新markdown文件中的图片引用"""
|
||
print("=" * 60)
|
||
print("开始更新Markdown文件...")
|
||
print("=" * 60)
|
||
|
||
# 读取markdown文件
|
||
with open(MD_FILE, 'r', encoding='utf-8') as f:
|
||
content = f.read()
|
||
|
||
# 替换图片引用
|
||
for old_name, new_name in IMAGE_MAPPING.items():
|
||
old_ref = f"image/{old_name}"
|
||
new_ref = f"image/{new_name}"
|
||
|
||
if old_ref in content:
|
||
content = content.replace(old_ref, new_ref)
|
||
print(f"✅ 已替换: {old_name} -> {new_name}")
|
||
else:
|
||
print(f"⚠️ 未找到引用: {old_name}")
|
||
|
||
# 写回文件
|
||
with open(MD_FILE, 'w', encoding='utf-8') as f:
|
||
f.write(content)
|
||
|
||
print("\nMarkdown文件更新完成!\n")
|
||
|
||
def verify_result():
|
||
"""验证结果"""
|
||
print("=" * 60)
|
||
print("验证结果...")
|
||
print("=" * 60)
|
||
|
||
# 检查图片文件
|
||
print("\n📁 图片文件列表:")
|
||
for filename in sorted(os.listdir(IMAGE_DIR)):
|
||
if filename.endswith(('.jpg', '.jpeg', '.png')):
|
||
print(f" - {filename}")
|
||
|
||
# 检查markdown引用
|
||
print("\n📄 Markdown中的图片引用:")
|
||
with open(MD_FILE, 'r', encoding='utf-8') as f:
|
||
content = f.read()
|
||
|
||
# 查找所有图片引用
|
||
image_refs = re.findall(r'!\[([^\]]*)\]\(image/([^)]+)\)', content)
|
||
for alt_text, filename in image_refs:
|
||
print(f" - [{alt_text}] -> image/{filename}")
|
||
|
||
print("\n✅ 验证完成!")
|
||
|
||
if __name__ == "__main__":
|
||
print("\n🚀 大健康订单班图片处理脚本")
|
||
print("=" * 60)
|
||
|
||
try:
|
||
# 1. 重命名图片
|
||
rename_images()
|
||
|
||
# 2. 更新markdown
|
||
update_markdown()
|
||
|
||
# 3. 验证结果
|
||
verify_result()
|
||
|
||
print("\n" + "=" * 60)
|
||
print("🎉 所有任务完成!")
|
||
print("=" * 60)
|
||
|
||
except Exception as e:
|
||
print(f"\n❌ 错误: {str(e)}")
|
||
import traceback
|
||
traceback.print_exc()
|