主要内容: - 包含12个产业的完整教务系统前端代码 - 智能启动脚本 (start-industry.sh) - 可视化产业导航页面 (index.html) - 项目文档 (README.md) 优化内容: - 删除所有node_modules和.yoyo文件夹,从7.5GB减少到2.7GB - 添加.gitignore文件避免上传不必要的文件 - 自动依赖管理和智能启动系统 产业列表: 1. 文旅产业 (5150) 2. 智能制造 (5151) 3. 智能开发 (5152) 4. 财经商贸 (5153) 5. 视觉设计 (5154) 6. 交通物流 (5155) 7. 大健康 (5156) 8. 土木水利 (5157) 9. 食品产业 (5158) 10. 化工产业 (5159) 11. 能源产业 (5160) 12. 环保产业 (5161) 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
175 lines
5.8 KiB
JavaScript
175 lines
5.8 KiB
JavaScript
import fs from 'fs';
|
||
import path from 'path';
|
||
import { fileURLToPath } from 'url';
|
||
|
||
const __filename = fileURLToPath(import.meta.url);
|
||
const __dirname = path.dirname(__filename);
|
||
|
||
// 读取财经商贸问答内容数据
|
||
const financeQAData = JSON.parse(
|
||
fs.readFileSync(path.join(__dirname, '网页未导入数据/财经商贸产业/财经商贸问答内容.json'), 'utf-8')
|
||
);
|
||
|
||
// 转换数据格式
|
||
const conversations = financeQAData.map((item, index) => {
|
||
const messages = [];
|
||
|
||
// 添加流程1(用户问题)
|
||
if (item["问题_流程1"]) {
|
||
messages.push({
|
||
type: "user",
|
||
content: item["问题_流程1"],
|
||
time: item["流程1_时间"]
|
||
});
|
||
}
|
||
|
||
// 添加流程2(助手回答)
|
||
if (item["回答_流程2"]) {
|
||
const isAIAnswer = item["问答类型"] === "智能客服";
|
||
messages.push({
|
||
type: "assistant",
|
||
content: item["回答_流程2"],
|
||
mentor: isAIAnswer ? "多多畅职机器人" : item["查询导师名称"] + "老师",
|
||
time: item["流程2_时间"],
|
||
mentorAvatar: isAIAnswer
|
||
? "https://ddcz-1315997005.cos.ap-nanjing.myqcloud.com/static/img/teach_sys_icon/recuWmDuekBTlr.png"
|
||
: getMentorAvatar(item["查询导师名称"])
|
||
});
|
||
}
|
||
|
||
// 添加流程3(用户问题)
|
||
if (item["问题_流程3"]) {
|
||
messages.push({
|
||
type: "user",
|
||
content: item["问题_流程3"],
|
||
time: item["流程3_时间"]
|
||
});
|
||
}
|
||
|
||
// 添加流程4(助手回答)
|
||
if (item["回答_流程4"]) {
|
||
const isAIAnswer = item["问答类型"] === "智能客服";
|
||
messages.push({
|
||
type: "assistant",
|
||
content: item["回答_流程4"],
|
||
mentor: isAIAnswer ? "多多畅职机器人" : item["查询导师名称"] + "老师",
|
||
time: item["流程4_时间"],
|
||
mentorAvatar: isAIAnswer
|
||
? "https://ddcz-1315997005.cos.ap-nanjing.myqcloud.com/static/img/teach_sys_icon/recuWmDuekBTlr.png"
|
||
: getMentorAvatar(item["查询导师名称"])
|
||
});
|
||
}
|
||
|
||
// 添加流程5(用户问题)
|
||
if (item["问题_流程5"]) {
|
||
messages.push({
|
||
type: "user",
|
||
content: item["问题_流程5"],
|
||
time: item["流程5_时间"]
|
||
});
|
||
}
|
||
|
||
// 添加流程6(助手回答)
|
||
if (item["回答_流程6"]) {
|
||
const isAIAnswer = item["问答类型"] === "智能客服";
|
||
messages.push({
|
||
type: "assistant",
|
||
content: item["回答_流程6"],
|
||
mentor: isAIAnswer ? "多多畅职机器人" : item["查询导师名称"] + "老师",
|
||
time: item["流程6_时间"],
|
||
mentorAvatar: isAIAnswer
|
||
? "https://ddcz-1315997005.cos.ap-nanjing.myqcloud.com/static/img/teach_sys_icon/recuWmDuekBTlr.png"
|
||
: getMentorAvatar(item["查询导师名称"])
|
||
});
|
||
}
|
||
|
||
// 过滤掉空内容的消息
|
||
const validMessages = messages.filter(msg => msg.content);
|
||
|
||
// 按时间排序消息(确保对话的时间顺序正确)
|
||
validMessages.sort((a, b) => {
|
||
const timeA = new Date(a.time.replace(/\//g, '-'));
|
||
const timeB = new Date(b.time.replace(/\//g, '-'));
|
||
return timeA - timeB;
|
||
});
|
||
|
||
// 从第一条消息时间提取年月
|
||
const firstTime = validMessages[0]?.time || "2024/1/1 00:00";
|
||
const [datePart] = firstTime.split(' ');
|
||
const [year, month] = datePart.split('/');
|
||
const dateStr = `${year}年${month}月`;
|
||
|
||
return {
|
||
id: index + 1,
|
||
title: item["问题标题"],
|
||
status: "finish",
|
||
date: dateStr,
|
||
type: item["问题类型"],
|
||
messages: validMessages
|
||
};
|
||
});
|
||
|
||
// 导师头像映射(使用真实的导师头像URL)
|
||
function getMentorAvatar(mentorName) {
|
||
const mentorAvatars = {
|
||
"刘红梅": "https://ddcz-1315997005.cos.ap-nanjing.myqcloud.com/static/img/teach_sys_teacher-avatar/recuW7dxJ5wnh1.png",
|
||
"朱琳琳": "https://ddcz-1315997005.cos.ap-nanjing.myqcloud.com/static/img/teach_sys_teacher-avatar/recuW7dxJ5J6yn.png",
|
||
"马国栋": "https://ddcz-1315997005.cos.ap-nanjing.myqcloud.com/static/img/teach_sys_teacher-avatar/recuW7dxJ5fgO2.png",
|
||
"徐明辉": "https://ddcz-1315997005.cos.ap-nanjing.myqcloud.com/static/img/teach_sys_teacher-avatar/recuW7dxJ5j6oq.png",
|
||
"李奇": "https://ddcz-1315997005.cos.ap-nanjing.myqcloud.com/static/img/teach_sys_teacher-avatar/recuUpJBMNLZL5.png" // 李奇是AI答疑,保持原头像
|
||
};
|
||
|
||
return mentorAvatars[mentorName] || "https://ddcz-1315997005.cos.ap-nanjing.myqcloud.com/static/img/teach_sys_teacher-avatar/recuUpJBMNLZL5.png";
|
||
}
|
||
|
||
// 构建完整的数据结构
|
||
const expertSupportData = {
|
||
conversations: conversations
|
||
};
|
||
|
||
// 备份原文件
|
||
const backupPath = path.join(__dirname, 'src/data', `expertSupportData.js.backup_${new Date().toISOString().replace(/[:.]/g, '-')}`);
|
||
fs.copyFileSync(
|
||
path.join(__dirname, 'src/data/expertSupportData.js'),
|
||
backupPath
|
||
);
|
||
console.log(`备份已创建: ${backupPath}`);
|
||
|
||
// 生成新的文件内容
|
||
const fileContent = `// 从财经商贸问答内容.json转换的专家支持中心数据
|
||
const expertSupportData = ${JSON.stringify(expertSupportData, null, 2)};
|
||
|
||
export default expertSupportData;`;
|
||
|
||
// 写入文件
|
||
fs.writeFileSync(
|
||
path.join(__dirname, 'src/data/expertSupportData.js'),
|
||
fileContent,
|
||
'utf-8'
|
||
);
|
||
|
||
console.log(`成功更新专家支持中心数据,共 ${conversations.length} 个对话`);
|
||
|
||
// 统计信息
|
||
const typeStats = {};
|
||
conversations.forEach(conv => {
|
||
typeStats[conv.type] = (typeStats[conv.type] || 0) + 1;
|
||
});
|
||
|
||
console.log('\n问题类型统计:');
|
||
Object.entries(typeStats).forEach(([type, count]) => {
|
||
console.log(` ${type}: ${count} 个`);
|
||
});
|
||
|
||
// 统计导师参与情况
|
||
const mentorStats = {};
|
||
financeQAData.forEach(item => {
|
||
if (item["查询导师名称"]) {
|
||
mentorStats[item["查询导师名称"]] = (mentorStats[item["查询导师名称"]] || 0) + 1;
|
||
}
|
||
});
|
||
|
||
console.log('\n导师参与统计:');
|
||
Object.entries(mentorStats).forEach(([mentor, count]) => {
|
||
console.log(` ${mentor}: ${count} 个对话`);
|
||
}); |