|
@ -24,14 +24,6 @@ import { Howl, Howler } from "howler"; |
|
|
import * as echarts from "echarts"; |
|
|
import * as echarts from "echarts"; |
|
|
import _, { add } from "lodash"; |
|
|
import _, { add } from "lodash"; |
|
|
import moment from "moment"; |
|
|
import moment from "moment"; |
|
|
|
|
|
|
|
|
import AIgif1 from "@/assets/img/AIchat/AIgif1.gif"; |
|
|
|
|
|
import AIgif2 from "@/assets/img/AIchat/AIgif2.gif"; |
|
|
|
|
|
import AIgif3 from "@/assets/img/AIchat/AIgif3.gif"; |
|
|
|
|
|
import AIgif4 from "@/assets/img/AIchat/AIgif4.gif"; |
|
|
|
|
|
import AIgif5 from "@/assets/img/AIchat/AIgif5.gif"; |
|
|
|
|
|
import AIgif6 from "@/assets/img/AIchat/AIgif6.gif"; |
|
|
|
|
|
import AIgif7 from "@/assets/img/AIchat/AIgif7.gif"; |
|
|
|
|
|
import title1 from "@/assets/img/AIchat/核心价值评估标题.png"; |
|
|
import title1 from "@/assets/img/AIchat/核心价值评估标题.png"; |
|
|
import title2 from "@/assets/img/AIchat/主力作战.png"; |
|
|
import title2 from "@/assets/img/AIchat/主力作战.png"; |
|
|
import title3 from "@/assets/img/AIchat/攻防三维.png"; |
|
|
import title3 from "@/assets/img/AIchat/攻防三维.png"; |
|
@ -39,7 +31,6 @@ import title4 from "@/assets/img/AIchat/综合作战.png"; |
|
|
import logo1 from "@/assets/img/AIchat/夺宝奇兵logo.png"; |
|
|
import logo1 from "@/assets/img/AIchat/夺宝奇兵logo.png"; |
|
|
import logo2 from "@/assets/img/AIchat/开启无限财富.png"; |
|
|
import logo2 from "@/assets/img/AIchat/开启无限财富.png"; |
|
|
|
|
|
|
|
|
const gifList = [AIgif1, AIgif2, AIgif3, AIgif4, AIgif5, AIgif6, AIgif7]; |
|
|
|
|
|
const chatStore = useChatStore(); |
|
|
const chatStore = useChatStore(); |
|
|
const audioStore = useAudioStore(); |
|
|
const audioStore = useAudioStore(); |
|
|
const dataStore = useDataStore(); |
|
|
const dataStore = useDataStore(); |
|
@ -197,7 +188,7 @@ const playAudioSequence = (audioUrls) => { |
|
|
setTimeout(() => { |
|
|
setTimeout(() => { |
|
|
playNext(); |
|
|
playNext(); |
|
|
}, 100); |
|
|
}, 100); |
|
|
} |
|
|
|
|
|
|
|
|
}, |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
audioStore.nowSound = sound; |
|
|
audioStore.nowSound = sound; |
|
@ -552,24 +543,28 @@ watch( |
|
|
const HomePage = result20.data.HomePage; |
|
|
const HomePage = result20.data.HomePage; |
|
|
const AIGoldBull = result20.data.AIGoldBull; |
|
|
const AIGoldBull = result20.data.AIGoldBull; |
|
|
|
|
|
|
|
|
const result21 = await dbqbSecondOneAPI(params2); |
|
|
|
|
|
const result22 = await dbqbSecondTwoAPI(params2); |
|
|
|
|
|
const result23 = await dbqbSecondThreeAPI(params2); |
|
|
|
|
|
const result24 = await dbqbSecondFourAPI(params2); |
|
|
|
|
|
|
|
|
|
|
|
// 收集所有音频URL |
|
|
|
|
|
const audioUrls = []; |
|
|
|
|
|
if (result21.data.url) audioUrls.push(result21.data.url.trim()); |
|
|
|
|
|
if (result22.data.url) audioUrls.push(result22.data.url.trim()); |
|
|
|
|
|
if (result23.data.url) audioUrls.push(result23.data.url.trim()); |
|
|
|
|
|
if (result24.data.url) audioUrls.push(result24.data.url.trim()); |
|
|
|
|
|
|
|
|
const katexRegex = /\$\$(.*?)\$\$/g; |
|
|
|
|
|
|
|
|
// 开始轮流播放音频 |
|
|
|
|
|
if (audioUrls.length > 0 && audioStore.isVoiceEnabled) { |
|
|
|
|
|
playAudioSequence(audioUrls); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
let result21; |
|
|
|
|
|
let result22; |
|
|
|
|
|
let result23; |
|
|
|
|
|
let result24; |
|
|
|
|
|
// 用于跟踪API完成状态和结果 |
|
|
|
|
|
const apiStatus = { |
|
|
|
|
|
one: { completed: false, result: null, error: null }, |
|
|
|
|
|
two: { completed: false, result: null, error: null }, |
|
|
|
|
|
three: { completed: false, result: null, error: null }, |
|
|
|
|
|
four: { completed: false, result: null, error: null }, |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
const katexRegex = /\$\$(.*?)\$\$/g; |
|
|
|
|
|
|
|
|
// 检查并按顺序执行代码的函数 |
|
|
|
|
|
const checkAndExecuteInOrder = () => { |
|
|
|
|
|
// 检查OneAPI |
|
|
|
|
|
if (apiStatus.one.completed && !apiStatus.one.executed) { |
|
|
|
|
|
apiStatus.one.executed = true; |
|
|
|
|
|
if (apiStatus.one.result) { |
|
|
|
|
|
console.log("执行OneAPI代码:", apiStatus.one.result); |
|
|
|
|
|
// 在这里添加OneAPI成功后需要执行的代码 |
|
|
// 删除正在为您生成信息 |
|
|
// 删除正在为您生成信息 |
|
|
chatStore.messages.pop(); |
|
|
chatStore.messages.pop(); |
|
|
// 添加报告头和时间 |
|
|
// 添加报告头和时间 |
|
@ -602,7 +597,9 @@ watch( |
|
|
); |
|
|
); |
|
|
const ac1 = pc1.replace(katexRegex, (match, formula) => { |
|
|
const ac1 = pc1.replace(katexRegex, (match, formula) => { |
|
|
try { |
|
|
try { |
|
|
return katex.renderToString(formula, { throwOnError: false }); |
|
|
|
|
|
|
|
|
return katex.renderToString(formula, { |
|
|
|
|
|
throwOnError: false, |
|
|
|
|
|
}); |
|
|
} catch (error) { |
|
|
} catch (error) { |
|
|
console.error("KaTeX 渲染错误:", error); |
|
|
console.error("KaTeX 渲染错误:", error); |
|
|
return match; |
|
|
return match; |
|
@ -707,8 +704,12 @@ watch( |
|
|
// }); |
|
|
// }); |
|
|
|
|
|
|
|
|
// 度牛尺K线图 |
|
|
// 度牛尺K线图 |
|
|
const AIGoldBullData = JSON.parse(JSON.stringify(toRaw(AIGoldBull))); |
|
|
|
|
|
const HomePageData = JSON.parse(JSON.stringify(toRaw(HomePage))); |
|
|
|
|
|
|
|
|
const AIGoldBullData = JSON.parse( |
|
|
|
|
|
JSON.stringify(toRaw(AIGoldBull)) |
|
|
|
|
|
); |
|
|
|
|
|
const HomePageData = JSON.parse( |
|
|
|
|
|
JSON.stringify(toRaw(HomePage)) |
|
|
|
|
|
); |
|
|
console.log("处理 K 线数据 - 开始"); |
|
|
console.log("处理 K 线数据 - 开始"); |
|
|
console.log("AIGoldBullData", AIGoldBullData); |
|
|
console.log("AIGoldBullData", AIGoldBullData); |
|
|
console.log("HomePageData", HomePageData); |
|
|
console.log("HomePageData", HomePageData); |
|
@ -790,7 +791,19 @@ watch( |
|
|
// console.warn("未找到K线消息"); |
|
|
// console.warn("未找到K线消息"); |
|
|
// } |
|
|
// } |
|
|
// }); |
|
|
// }); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 检查TwoAPI(需要OneAPI已执行) |
|
|
|
|
|
if ( |
|
|
|
|
|
apiStatus.one.executed && |
|
|
|
|
|
apiStatus.two.completed && |
|
|
|
|
|
!apiStatus.two.executed |
|
|
|
|
|
) { |
|
|
|
|
|
apiStatus.two.executed = true; |
|
|
|
|
|
if (apiStatus.two.result) { |
|
|
|
|
|
console.log("执行TwoAPI代码:", apiStatus.two.result); |
|
|
|
|
|
// 在这里添加TwoAPI成功后需要执行的代码 |
|
|
// 添加标题2 |
|
|
// 添加标题2 |
|
|
addTypingTask( |
|
|
addTypingTask( |
|
|
{ |
|
|
{ |
|
@ -813,7 +826,9 @@ watch( |
|
|
console.log(pc2, "pc2"); |
|
|
console.log(pc2, "pc2"); |
|
|
const ac2 = pc2.replace(katexRegex, (match, formula) => { |
|
|
const ac2 = pc2.replace(katexRegex, (match, formula) => { |
|
|
try { |
|
|
try { |
|
|
return katex.renderToString(formula, { throwOnError: false }); |
|
|
|
|
|
|
|
|
return katex.renderToString(formula, { |
|
|
|
|
|
throwOnError: false, |
|
|
|
|
|
}); |
|
|
} catch (error) { |
|
|
} catch (error) { |
|
|
console.error("KaTeX 渲染错误:", error); |
|
|
console.error("KaTeX 渲染错误:", error); |
|
|
return match; |
|
|
return match; |
|
@ -848,6 +863,19 @@ watch( |
|
|
// type: "content3", |
|
|
// type: "content3", |
|
|
// content: ac2, |
|
|
// content: ac2, |
|
|
// }); |
|
|
// }); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 检查ThreeAPI(需要TwoAPI已执行) |
|
|
|
|
|
if ( |
|
|
|
|
|
apiStatus.two.executed && |
|
|
|
|
|
apiStatus.three.completed && |
|
|
|
|
|
!apiStatus.three.executed |
|
|
|
|
|
) { |
|
|
|
|
|
apiStatus.three.executed = true; |
|
|
|
|
|
if (apiStatus.three.result) { |
|
|
|
|
|
console.log("执行ThreeAPI代码:", apiStatus.three.result); |
|
|
|
|
|
// 在这里添加ThreeAPI成功后需要执行的代码 |
|
|
// 添加标题3-2 |
|
|
// 添加标题3-2 |
|
|
addTypingTask( |
|
|
addTypingTask( |
|
|
{ |
|
|
{ |
|
@ -978,6 +1006,19 @@ watch( |
|
|
// type: "content3", |
|
|
// type: "content3", |
|
|
// content: ac4, |
|
|
// content: ac4, |
|
|
// }); |
|
|
// }); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 检查FourAPI(需要ThreeAPI已执行) |
|
|
|
|
|
if ( |
|
|
|
|
|
apiStatus.three.executed && |
|
|
|
|
|
apiStatus.four.completed && |
|
|
|
|
|
!apiStatus.four.executed |
|
|
|
|
|
) { |
|
|
|
|
|
apiStatus.four.executed = true; |
|
|
|
|
|
if (apiStatus.four.result) { |
|
|
|
|
|
console.log("执行FourAPI代码:", apiStatus.four.result); |
|
|
|
|
|
// 在这里添加FourAPI成功后需要执行的代码 |
|
|
// 添加标题3-4 |
|
|
// 添加标题3-4 |
|
|
addTypingTask( |
|
|
addTypingTask( |
|
|
{ |
|
|
{ |
|
@ -989,12 +1030,12 @@ watch( |
|
|
"", |
|
|
"", |
|
|
50 |
|
|
50 |
|
|
); |
|
|
); |
|
|
chatStore.messages.push({ |
|
|
|
|
|
sender: "ai", |
|
|
|
|
|
class: "title3", |
|
|
|
|
|
type: "title3", |
|
|
|
|
|
content: title4, |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
// chatStore.messages.push({ |
|
|
|
|
|
// sender: "ai", |
|
|
|
|
|
// class: "title3", |
|
|
|
|
|
// type: "title3", |
|
|
|
|
|
// content: title4, |
|
|
|
|
|
// }); |
|
|
// 添加内容框4 |
|
|
// 添加内容框4 |
|
|
const cftj = `<p style="margin:0;color:#FADC0C;display:flex;justify-content:center;font-size:28px">【触发条件】</p><p>${result24.data.cftl}</p>`; |
|
|
const cftj = `<p style="margin:0;color:#FADC0C;display:flex;justify-content:center;font-size:28px">【触发条件】</p><p>${result24.data.cftl}</p>`; |
|
|
const gfzl = `<p style="margin:0;color:#FADC0C;display:flex;justify-content:center;font-size:28px">【攻防指令】</p><p>${result24.data.gfzl}</p>`; |
|
|
const gfzl = `<p style="margin:0;color:#FADC0C;display:flex;justify-content:center;font-size:28px">【攻防指令】</p><p>${result24.data.gfzl}</p>`; |
|
@ -1070,6 +1111,144 @@ watch( |
|
|
// type: "mianze", |
|
|
// type: "mianze", |
|
|
// content: "内容由AI生成,请注意甄别", |
|
|
// content: "内容由AI生成,请注意甄别", |
|
|
// }); |
|
|
// }); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const handleOneAPI = async () => { |
|
|
|
|
|
try { |
|
|
|
|
|
result21 = await dbqbSecondOneAPI(params2); |
|
|
|
|
|
console.log("OneAPI成功返回:", result21); |
|
|
|
|
|
|
|
|
|
|
|
apiStatus.one.completed = true; |
|
|
|
|
|
apiStatus.one.result = result21; |
|
|
|
|
|
|
|
|
|
|
|
// 检查是否可以执行 |
|
|
|
|
|
checkAndExecuteInOrder(); |
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
console.error("OneAPI失败:", error); |
|
|
|
|
|
apiStatus.one.completed = true; |
|
|
|
|
|
apiStatus.one.error = error; |
|
|
|
|
|
// 即使失败也要检查后续执行 |
|
|
|
|
|
checkAndExecuteInOrder(); |
|
|
|
|
|
} |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const handleTwoAPI = async () => { |
|
|
|
|
|
try { |
|
|
|
|
|
result22 = await dbqbSecondTwoAPI(params2); |
|
|
|
|
|
console.log("TwoAPI成功返回:", result22); |
|
|
|
|
|
|
|
|
|
|
|
apiStatus.two.completed = true; |
|
|
|
|
|
apiStatus.two.result = result22; |
|
|
|
|
|
|
|
|
|
|
|
// 检查是否可以执行 |
|
|
|
|
|
checkAndExecuteInOrder(); |
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
console.error("TwoAPI失败:", error); |
|
|
|
|
|
apiStatus.two.completed = true; |
|
|
|
|
|
apiStatus.two.error = error; |
|
|
|
|
|
checkAndExecuteInOrder(); |
|
|
|
|
|
} |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const handleThreeAPI = async () => { |
|
|
|
|
|
try { |
|
|
|
|
|
result23 = await dbqbSecondThreeAPI(params2); |
|
|
|
|
|
console.log("ThreeAPI成功返回:", result23); |
|
|
|
|
|
|
|
|
|
|
|
apiStatus.three.completed = true; |
|
|
|
|
|
apiStatus.three.result = result23; |
|
|
|
|
|
|
|
|
|
|
|
// 检查是否可以执行 |
|
|
|
|
|
checkAndExecuteInOrder(); |
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
console.error("ThreeAPI失败:", error); |
|
|
|
|
|
apiStatus.three.completed = true; |
|
|
|
|
|
apiStatus.three.error = error; |
|
|
|
|
|
checkAndExecuteInOrder(); |
|
|
|
|
|
} |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const handleFourAPI = async () => { |
|
|
|
|
|
try { |
|
|
|
|
|
result24 = await dbqbSecondFourAPI(params2); |
|
|
|
|
|
console.log("FourAPI成功返回:", result24); |
|
|
|
|
|
|
|
|
|
|
|
apiStatus.four.completed = true; |
|
|
|
|
|
apiStatus.four.result = result24; |
|
|
|
|
|
|
|
|
|
|
|
// 检查是否可以执行 |
|
|
|
|
|
checkAndExecuteInOrder(); |
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
console.error("FourAPI失败:", error); |
|
|
|
|
|
apiStatus.four.completed = true; |
|
|
|
|
|
apiStatus.four.error = error; |
|
|
|
|
|
checkAndExecuteInOrder(); |
|
|
|
|
|
} |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
handleOneAPI(); |
|
|
|
|
|
handleTwoAPI(); |
|
|
|
|
|
handleThreeAPI(); |
|
|
|
|
|
handleFourAPI(); |
|
|
|
|
|
|
|
|
|
|
|
// 同时发起所有API调用 |
|
|
|
|
|
// const promises = [ |
|
|
|
|
|
// dbqbSecondOneAPI(params2), |
|
|
|
|
|
// dbqbSecondTwoAPI(params2), |
|
|
|
|
|
// dbqbSecondThreeAPI(params2), |
|
|
|
|
|
// dbqbSecondFourAPI(params2), |
|
|
|
|
|
// ]; |
|
|
|
|
|
// const results = await Promise.allSettled(promises); |
|
|
|
|
|
// let result21; |
|
|
|
|
|
// let result22; |
|
|
|
|
|
// let result23; |
|
|
|
|
|
// let result24; |
|
|
|
|
|
// // 检查每个API的结果并执行相应代码 |
|
|
|
|
|
// console |
|
|
|
|
|
// if (results[0].status === "fulfilled") { |
|
|
|
|
|
// result21 = results[0].value; |
|
|
|
|
|
// // oneAPI成功返回时执行的代码 |
|
|
|
|
|
// console.log("oneAPI成功:", result21); |
|
|
|
|
|
// // 在这里添加你的业务逻辑 |
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
// if (results[1].status === "fulfilled") { |
|
|
|
|
|
// result22 = results[1].value; |
|
|
|
|
|
// // twoAPI成功返回时执行的代码 |
|
|
|
|
|
// console.log("twoAPI成功:", result22); |
|
|
|
|
|
// // 在这里添加你的业务逻辑 |
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
// if (results[2].status === "fulfilled") { |
|
|
|
|
|
// result23 = results[2].value; |
|
|
|
|
|
// // threeAPI成功返回时执行的代码 |
|
|
|
|
|
// console.log("threeAPI成功:", result23); |
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
// if (results[3].status === "fulfilled") { |
|
|
|
|
|
// result24 = results[3].value; |
|
|
|
|
|
// // fourAPI成功返回时执行的代码 |
|
|
|
|
|
// console.log("fourAPI成功:", result24); |
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
// const result21 = await dbqbSecondOneAPI(params2); |
|
|
|
|
|
// const result22 = await dbqbSecondTwoAPI(params2); |
|
|
|
|
|
// const result23 = await dbqbSecondThreeAPI(params2); |
|
|
|
|
|
// const result24 = await dbqbSecondFourAPI(params2); |
|
|
|
|
|
|
|
|
|
|
|
// 收集所有音频URL |
|
|
|
|
|
const audioUrls = []; |
|
|
|
|
|
if (result21.data.url) audioUrls.push(result21.data.url.trim()); |
|
|
|
|
|
if (result22.data.url) audioUrls.push(result22.data.url.trim()); |
|
|
|
|
|
if (result23.data.url) audioUrls.push(result23.data.url.trim()); |
|
|
|
|
|
if (result24.data.url) audioUrls.push(result24.data.url.trim()); |
|
|
|
|
|
|
|
|
|
|
|
// 开始轮流播放音频 |
|
|
|
|
|
if (audioUrls.length > 0 && audioStore.isVoiceEnabled) { |
|
|
|
|
|
playAudioSequence(audioUrls); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// // 修改后的消息处理逻辑 |
|
|
// // 修改后的消息处理逻辑 |
|
|
// const processedContent = marked(AIcontent.value); |
|
|
// const processedContent = marked(AIcontent.value); |
|
@ -2754,9 +2933,6 @@ onMounted(() => { |
|
|
renderer: renderer, |
|
|
renderer: renderer, |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
const random = Math.floor(Math.random() * 6) + 1; |
|
|
|
|
|
currentGif.value = gifList[random]; |
|
|
|
|
|
|
|
|
|
|
|
console.log("组件挂载完成"); |
|
|
console.log("组件挂载完成"); |
|
|
|
|
|
|
|
|
// 添加DOM变化监听器 |
|
|
// 添加DOM变化监听器 |
|
@ -2884,7 +3060,6 @@ onUnmounted(() => { |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<style scoped> |
|
|
<style scoped> |
|
|
|
|
|
|
|
|
.logo2 { |
|
|
.logo2 { |
|
|
margin-top: 20px; |
|
|
margin-top: 20px; |
|
|
} |
|
|
} |
|
|