176 lines
7.2 KiB
JavaScript
176 lines
7.2 KiB
JavaScript
|
|
const fs = require('fs');
|
|||
|
|
const path = require('path');
|
|||
|
|
|
|||
|
|
// 读取智能开发内容问答.json
|
|||
|
|
const smartDevQA = JSON.parse(
|
|||
|
|
fs.readFileSync('./网页未导入数据/智能开发产业/智能开发内容问答.json', 'utf-8')
|
|||
|
|
);
|
|||
|
|
|
|||
|
|
console.log(`找到 ${smartDevQA.length} 条智能开发产业问答数据`);
|
|||
|
|
|
|||
|
|
// 导师头像映射
|
|||
|
|
const mentorAvatars = {
|
|||
|
|
"何思远": "https://ddcz-1315997005.cos.ap-nanjing.myqcloud.com/static/img/teach_sys_teacher-avatar/recuW7dxJ5LTXW.png",
|
|||
|
|
"王振宇": "https://ddcz-1315997005.cos.ap-nanjing.myqcloud.com/static/img/teach_sys_teacher-avatar/recuW7dxJ5GfLu.png",
|
|||
|
|
"赵立新": "https://ddcz-1315997005.cos.ap-nanjing.myqcloud.com/static/img/teach_sys_teacher-avatar/recuW7dxJ5BeLt.png",
|
|||
|
|
"谢宇程": "https://ddcz-1315997005.cos.ap-nanjing.myqcloud.com/static/img/teach_sys_teacher-avatar/recuW7dxJ5xnc9.png",
|
|||
|
|
"多多畅职机器人": "https://ddcz-1315997005.cos.ap-nanjing.myqcloud.com/static/img/teach_sys_icon/recuWmDuekBTlr.png"
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
// 转换数据格式
|
|||
|
|
const conversations = [];
|
|||
|
|
let conversationId = 1;
|
|||
|
|
|
|||
|
|
smartDevQA.forEach((qa, index) => {
|
|||
|
|
const messages = [];
|
|||
|
|
|
|||
|
|
// 获取日期(从第一个时间戳提取)
|
|||
|
|
let conversationDate = "2024年3月";
|
|||
|
|
if (qa['流程1_时间']) {
|
|||
|
|
const dateMatch = qa['流程1_时间'].match(/(\d{4})\/(\d{1,2})/);
|
|||
|
|
if (dateMatch) {
|
|||
|
|
const months = ['', '1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'];
|
|||
|
|
conversationDate = `${dateMatch[1]}年${months[parseInt(dateMatch[2])]}`;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 添加问答流程(最多6轮)
|
|||
|
|
for (let i = 1; i <= 6; i++) {
|
|||
|
|
const questionKey = i === 1 ? '问题_流程1' : `问题_流程${i}`;
|
|||
|
|
const answerKey = `回答_流程${i * 2}`;
|
|||
|
|
const questionTimeKey = `流程${i}_时间`;
|
|||
|
|
const answerTimeKey = `流程${i * 2}_时间`;
|
|||
|
|
|
|||
|
|
// 添加用户问题
|
|||
|
|
if (qa[questionKey] && qa[questionKey].trim()) {
|
|||
|
|
messages.push({
|
|||
|
|
type: "user",
|
|||
|
|
content: qa[questionKey],
|
|||
|
|
time: qa[questionTimeKey] || `2024/3/${10 + i} ${10 + i}:00`
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 添加回答
|
|||
|
|
if (qa[answerKey] && qa[answerKey].trim()) {
|
|||
|
|
const mentorName = qa['查询导师名称'] || "多多畅职机器人";
|
|||
|
|
const displayName = mentorName === "" ? "多多畅职机器人" :
|
|||
|
|
mentorName.includes("老师") ? mentorName : `${mentorName}老师`;
|
|||
|
|
|
|||
|
|
messages.push({
|
|||
|
|
type: "assistant",
|
|||
|
|
content: qa[answerKey],
|
|||
|
|
mentor: displayName,
|
|||
|
|
time: qa[answerTimeKey] || `2024/3/${10 + i} ${10 + i}:01`,
|
|||
|
|
mentorAvatar: mentorAvatars[mentorName] || mentorAvatars["多多畅职机器人"]
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 只添加有内容的对话
|
|||
|
|
if (messages.length > 0) {
|
|||
|
|
conversations.push({
|
|||
|
|
id: conversationId++,
|
|||
|
|
title: qa['问题标题'] || `智能开发问题${index + 1}`,
|
|||
|
|
status: "finish",
|
|||
|
|
date: conversationDate,
|
|||
|
|
type: qa['问题类型'] || "常规问题",
|
|||
|
|
messages: messages
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
// 构建完整的expertSupportData对象
|
|||
|
|
const expertSupportData = {
|
|||
|
|
conversations: conversations,
|
|||
|
|
|
|||
|
|
// 预设的FAQ问题
|
|||
|
|
faqs: [
|
|||
|
|
{
|
|||
|
|
id: 1,
|
|||
|
|
question: "什么是AI大前端开发?",
|
|||
|
|
answer: "AI大前端开发是将人工智能技术与前端开发相结合的新兴领域。它不仅包括传统的Web前端、移动端开发,还涉及AI模型的前端集成、智能交互设计、以及利用大模型优化用户体验等方面。",
|
|||
|
|
category: "AI技术"
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
id: 2,
|
|||
|
|
question: "AIOps智能运维主要做什么?",
|
|||
|
|
answer: "AIOps智能运维通过机器学习和大数据分析,实现IT系统的自动化监控、故障预测、根因分析和自动修复。它能够帮助企业提升运维效率,降低故障率,实现智能化的IT管理。",
|
|||
|
|
category: "运维技术"
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
id: 3,
|
|||
|
|
question: "网络安全在智能开发中的重要性?",
|
|||
|
|
answer: "随着AI技术的广泛应用,网络安全变得更加重要。需要防护AI模型被攻击、数据泄露、以及新型的AI驱动攻击。同时,也可以利用AI技术提升安全防护能力,如智能威胁检测、自动化响应等。",
|
|||
|
|
category: "安全技术"
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
id: 4,
|
|||
|
|
question: "如何入门AI智能应用开发?",
|
|||
|
|
answer: "建议从Python编程基础开始,学习机器学习和深度学习的基本概念,掌握主流框架如TensorFlow、PyTorch。然后学习大模型应用、RAG技术,并通过实际项目练习,逐步提升实战能力。",
|
|||
|
|
category: "学习路径"
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
id: 5,
|
|||
|
|
question: "智能开发产业的就业前景如何?",
|
|||
|
|
answer: "智能开发产业正处于快速发展期,人才需求旺盛。无论是AI应用开发、智能运维、网络安全还是大前端开发,都有广阔的就业空间。掌握AI+专业技能的复合型人才尤其受欢迎。",
|
|||
|
|
category: "就业指导"
|
|||
|
|
}
|
|||
|
|
],
|
|||
|
|
|
|||
|
|
// 专家信息
|
|||
|
|
expertProfiles: [
|
|||
|
|
{
|
|||
|
|
id: 1,
|
|||
|
|
name: "何思远",
|
|||
|
|
title: "网络安全专家",
|
|||
|
|
avatar: "https://ddcz-1315997005.cos.ap-nanjing.myqcloud.com/static/img/teach_sys_teacher-avatar/recuW7dxJ5LTXW.png",
|
|||
|
|
expertise: ["网络安全架构", "威胁情报分析", "零信任架构", "AI安全防护"],
|
|||
|
|
introduction: "15年网络安全经验,省部级科技奖得主"
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
id: 2,
|
|||
|
|
name: "王振宇",
|
|||
|
|
title: "AI大前端专家",
|
|||
|
|
avatar: "https://ddcz-1315997005.cos.ap-nanjing.myqcloud.com/static/img/teach_sys_teacher-avatar/recuW7dxJ5GfLu.png",
|
|||
|
|
expertise: ["AI前端融合", "跨平台开发", "智能交互设计", "性能优化"],
|
|||
|
|
introduction: "7年AI大前端经验,企业创新奖得主"
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
id: 3,
|
|||
|
|
name: "赵立新",
|
|||
|
|
title: "AI应用开发专家",
|
|||
|
|
avatar: "https://ddcz-1315997005.cos.ap-nanjing.myqcloud.com/static/img/teach_sys_teacher-avatar/recuW7dxJ5BeLt.png",
|
|||
|
|
expertise: ["大模型应用", "RAG技术", "多模态交互", "知识图谱"],
|
|||
|
|
introduction: "8年AI应用开发经验,省级科技奖得主"
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
id: 4,
|
|||
|
|
name: "谢宇程",
|
|||
|
|
title: "AIOps智能运维专家",
|
|||
|
|
avatar: "https://ddcz-1315997005.cos.ap-nanjing.myqcloud.com/static/img/teach_sys_teacher-avatar/recuW7dxJ5xnc9.png",
|
|||
|
|
expertise: ["智能监控", "故障预测", "自动化运维", "云原生技术"],
|
|||
|
|
introduction: "15年智能运维经验,故障修复时间缩短40%"
|
|||
|
|
}
|
|||
|
|
]
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
// 生成expertSupportData.js文件内容
|
|||
|
|
const fileContent = `// 智能开发产业专家支持中心数据
|
|||
|
|
const expertSupportData = ${JSON.stringify(expertSupportData, null, 2)};
|
|||
|
|
|
|||
|
|
export { expertSupportData };
|
|||
|
|
export default expertSupportData;`;
|
|||
|
|
|
|||
|
|
// 写入文件
|
|||
|
|
fs.writeFileSync('./src/data/expertSupportData.js', fileContent, 'utf-8');
|
|||
|
|
|
|||
|
|
console.log('✅ 专家支持中心数据更新成功!');
|
|||
|
|
console.log(`- 生成了 ${conversations.length} 个对话`);
|
|||
|
|
console.log(`- 包含 ${expertSupportData.faqs.length} 个FAQ`);
|
|||
|
|
console.log(`- 包含 ${expertSupportData.expertProfiles.length} 位专家信息`);
|
|||
|
|
|
|||
|
|
// 输出前3个对话标题作为示例
|
|||
|
|
console.log('\n对话示例:');
|
|||
|
|
conversations.slice(0, 3).forEach(conv => {
|
|||
|
|
console.log(` - ${conv.title} (${conv.type})`);
|
|||
|
|
});
|