Browse Source

Merge branch 'ds_hxl' into ds

hongxilin/hotfix-20250625101643-手机输入法弹出输入框上浮
宋杰 1 week ago
parent
commit
42d8fc43bd
  1. BIN
      src/assets/img/AIchat/夺宝奇兵logo.png
  2. BIN
      src/assets/img/AIchat/开启无限财富.png
  3. 263
      src/views/AIchat.vue

BIN
src/assets/img/AIchat/夺宝奇兵logo.png

After

Width: 185  |  Height: 101  |  Size: 30 KiB

BIN
src/assets/img/AIchat/开启无限财富.png

After

Width: 594  |  Height: 101  |  Size: 16 KiB

263
src/views/AIchat.vue

@ -24,20 +24,13 @@ 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";
import title4 from "@/assets/img/AIchat/综合作战.png"; import title4 from "@/assets/img/AIchat/综合作战.png";
import logo1 from "@/assets/img/AIchat/夺宝奇兵logo.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();
@ -195,7 +188,7 @@ const playAudioSequence = (audioUrls) => {
setTimeout(() => { setTimeout(() => {
playNext(); playNext();
}, 100); }, 100);
}
},
}); });
audioStore.nowSound = sound; audioStore.nowSound = sound;
@ -550,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();
// //
@ -600,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;
@ -705,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);
@ -788,7 +791,19 @@ watch(
// console.warn("K线"); // console.warn("K线");
// } // }
// }); // });
}
}
// TwoAPIOneAPI
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(
{ {
@ -811,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;
@ -846,6 +863,19 @@ watch(
// type: "content3", // type: "content3",
// content: ac2, // content: ac2,
// }); // });
}
}
// ThreeAPITwoAPI
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(
{ {
@ -976,6 +1006,19 @@ watch(
// type: "content3", // type: "content3",
// content: ac4, // content: ac4,
// }); // });
}
}
// FourAPIThreeAPI
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(
{ {
@ -987,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>`;
@ -1068,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);
@ -2752,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
@ -2799,7 +2977,8 @@ onUnmounted(() => {
<div class="chat-container"> <div class="chat-container">
<!-- GIF区域 --> <!-- GIF区域 -->
<div class="gif-area"> <div class="gif-area">
<img :src="currentGif" alt="AI动画" />
<img :src="logo1" alt="夺宝奇兵大模型logo" />
<img :src="logo2" alt="夺宝奇兵大模型logo" class="logo2" />
</div> </div>
<div <div
@ -2881,6 +3060,10 @@ onUnmounted(() => {
</template> </template>
<style scoped> <style scoped>
.logo2 {
margin-top: 20px;
}
.chat-container { .chat-container {
display: flex; display: flex;
flex-direction: column; flex-direction: column;

Loading…
Cancel
Save