详细说明: - 删除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>
87 lines
2.5 KiB
Python
87 lines
2.5 KiB
Python
#!/usr/bin/env python3
|
||
# -*- coding: utf-8 -*-
|
||
"""
|
||
更新文旅订单班相关路径引用脚本
|
||
"""
|
||
import os
|
||
import re
|
||
|
||
BASE_DIR = "/Users/xiaoqi/Documents/Dev/Project/2025-09-08_n8nDEMO演示/web_frontend/exhibition-demo/src"
|
||
|
||
# 需要更新的文件
|
||
FILES_TO_UPDATE = [
|
||
"data/terminalSimulations/wenlu.ts",
|
||
"pages/WorkflowPageV4.tsx"
|
||
]
|
||
|
||
# 路径替换规则
|
||
PATH_REPLACEMENTS = {
|
||
"/data/会展策划/image/": "/data/订单班文档资料/文旅/notion文稿/image/"
|
||
}
|
||
|
||
def update_file(file_path):
|
||
"""更新单个文件中的路径引用"""
|
||
full_path = os.path.join(BASE_DIR, file_path)
|
||
|
||
if not os.path.exists(full_path):
|
||
print(f"⚠️ 文件不存在: {file_path}")
|
||
return False
|
||
|
||
print(f"\n📝 处理文件: {file_path}")
|
||
|
||
# 读取文件
|
||
with open(full_path, 'r', encoding='utf-8') as f:
|
||
content = f.read()
|
||
|
||
original_content = content
|
||
updated_count = 0
|
||
|
||
# 替换路径
|
||
for old_path, new_path in PATH_REPLACEMENTS.items():
|
||
if old_path in content:
|
||
count = content.count(old_path)
|
||
content = content.replace(old_path, new_path)
|
||
updated_count += count
|
||
print(f" ✅ 替换 {count} 处: {old_path} -> {new_path}")
|
||
|
||
# 写回文件
|
||
if content != original_content:
|
||
with open(full_path, 'w', encoding='utf-8') as f:
|
||
f.write(content)
|
||
print(f" ✅ 文件已更新,共 {updated_count} 处修改")
|
||
return True
|
||
else:
|
||
print(f" ℹ️ 无需更新")
|
||
return False
|
||
|
||
def main():
|
||
print("=" * 70)
|
||
print("🚀 文旅订单班路径更新脚本")
|
||
print("=" * 70)
|
||
|
||
updated_files = []
|
||
|
||
for file_path in FILES_TO_UPDATE:
|
||
if update_file(file_path):
|
||
updated_files.append(file_path)
|
||
|
||
print("\n" + "=" * 70)
|
||
print(f"✅ 完成!共更新 {len(updated_files)} 个文件")
|
||
print("=" * 70)
|
||
|
||
if updated_files:
|
||
print("\n更新的文件:")
|
||
for f in updated_files:
|
||
print(f" - {f}")
|
||
|
||
print("\n⚠️ 提示: 请手动删除以下旧文件夹:")
|
||
print(" 1. /web_frontend/exhibition-demo/public/data/会展策划")
|
||
print(" 2. /web_frontend/exhibition-demo/public/data/Agent_prompt")
|
||
print(" 3. /web_frontend/exhibition-demo/public/data/agent头像")
|
||
print(" 4. /web_frontend/data/会展策划 notion文稿")
|
||
print(" 5. /web_frontend/data/Agent_prompt")
|
||
print(" 6. /web_frontend/data/agent头像")
|
||
|
||
if __name__ == "__main__":
|
||
main()
|