主要更新: - 更新所有12个产业的教务系统数据和功能 - 删除所有 node_modules 文件夹(节省3.7GB) - 删除所有 .yoyo 缓存文件夹(节省1.2GB) - 删除所有 dist 构建文件(节省55MB) 项目优化: - 项目大小从 8.1GB 减少到 3.2GB(节省60%空间) - 保留完整的源代码和配置文件 - .gitignore 已配置,防止再次提交大文件 启动脚本: - start-industry.sh/bat/ps1 脚本会自动检测并安装依赖 - 首次启动时自动运行 npm install - 支持单个或批量启动产业系统 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
88 lines
3.0 KiB
JavaScript
88 lines
3.0 KiB
JavaScript
import fs from 'fs';
|
||
|
||
// 读取环保问答内容数据
|
||
const envQAData = JSON.parse(fs.readFileSync('./网页未导入数据/环保产业/环保问答内容.json', 'utf8'));
|
||
|
||
// 导师头像映射
|
||
const mentorAvatars = {
|
||
"何晓凯": "https://ddcz-1315997005.cos.ap-nanjing.myqcloud.com/static/img/teach_sys_teacher-avatar/recuW70q6gekXc.png",
|
||
"赵雅芳": "https://ddcz-1315997005.cos.ap-nanjing.myqcloud.com/static/img/teach_sys_teacher-avatar/recuW7dxJ547VI.png",
|
||
"丁增辉": "https://ddcz-1315997005.cos.ap-nanjing.myqcloud.com/static/img/teach_sys_teacher-avatar/recuW7dxJ5I7zh.jpeg",
|
||
"": "https://ddcz-1315997005.cos.ap-nanjing.myqcloud.com/static/img/teach_sys_icon/recuWmDuekBTlr.png" // 多多畅职机器人头像
|
||
};
|
||
|
||
// 转换数据格式
|
||
const conversations = [];
|
||
|
||
envQAData.forEach((qa, index) => {
|
||
const conversation = {
|
||
id: index + 1,
|
||
title: qa["问题标题(AI)"],
|
||
status: "finish",
|
||
date: qa["流程1_时间"] ? qa["流程1_时间"].split('/').slice(0, 2).join('年') + '月' : "2024年",
|
||
type: qa["问答类型"],
|
||
messages: []
|
||
};
|
||
|
||
// 处理流程1-6的问答
|
||
for (let i = 1; i <= 6; i += 2) {
|
||
const questionKey = `问题_流程${i}`;
|
||
const questionTimeKey = `流程${i}_时间`;
|
||
const answerKey = `回答_流程${i+1}`;
|
||
const answerTimeKey = `流程${i+1}_时间`;
|
||
|
||
const question = qa[questionKey];
|
||
const questionTime = qa[questionTimeKey];
|
||
const answer = qa[answerKey];
|
||
const answerTime = qa[answerTimeKey];
|
||
|
||
if (question && question.trim() !== '') {
|
||
// 添加用户问题
|
||
conversation.messages.push({
|
||
type: "user",
|
||
content: question,
|
||
time: questionTime || `2024/${index + 1}/${10 + i} 12:00`
|
||
});
|
||
|
||
// 添加回答
|
||
if (answer && answer.trim() !== '') {
|
||
const mentorName = qa["查询导师名称"] || "";
|
||
const displayName = mentorName ? mentorName + "老师" : "多多畅职机器人";
|
||
|
||
conversation.messages.push({
|
||
type: "assistant",
|
||
content: answer,
|
||
mentor: displayName,
|
||
time: answerTime || `2024/${index + 1}/${10 + i} 12:01`,
|
||
mentorAvatar: mentorAvatars[mentorName] || mentorAvatars[""]
|
||
});
|
||
}
|
||
}
|
||
}
|
||
|
||
if (conversation.messages.length > 0) {
|
||
conversations.push(conversation);
|
||
}
|
||
});
|
||
|
||
// 构建完整的expertSupportData结构
|
||
const expertSupportData = {
|
||
conversations: conversations
|
||
};
|
||
|
||
// 输出转换后的数据
|
||
console.log('转换完成!共生成', conversations.length, '个对话');
|
||
console.log('每个对话的消息数量:');
|
||
conversations.forEach((conv, i) => {
|
||
console.log(` 对话${i + 1} [${conv.title}]:${conv.messages.length}条消息`);
|
||
});
|
||
|
||
// 保存到文件
|
||
const outputPath = './src/data/expertSupportData.js';
|
||
const fileContent = `// 从环保问答内容.json转换的专家支持中心数据
|
||
const expertSupportData = ${JSON.stringify(expertSupportData, null, 2)};
|
||
|
||
export default expertSupportData;`;
|
||
|
||
fs.writeFileSync(outputPath, fileContent, 'utf8');
|
||
console.log('\n数据已保存到:', outputPath); |