Browse Source

音频问题1

dev
no99 2 days ago
parent
commit
98c4d841f2
  1. 42
      src/views/AIchat.vue
  2. 2
      src/views/homePage.vue

42
src/views/AIchat.vue

@ -19,9 +19,9 @@ import { useAudioStore } from "../store/audio";
import { useDataStore } from "@/store/dataList.js";
import { marked } from "marked"; // marked
// GIF
import thinkingGif from '@/assets/img/gif/思考.gif';
import analyzeGif from '@/assets/img/gif/解析.gif';
import generateGif from '@/assets/img/gif/生成.gif';
import thinkingGif from "@/assets/img/gif/思考.gif";
import analyzeGif from "@/assets/img/gif/解析.gif";
import generateGif from "@/assets/img/gif/生成.gif";
import katex from "katex"; // KaTeX
import { htmlToText } from "html-to-text";
import { Howl, Howler } from "howler";
@ -1063,6 +1063,29 @@ watch(
previousMessagesLength.value = newVal.length;
if (newVal.length > 0) {
//
chatStore.currentUserIndex = null;
audioStore.stop(); //
// 🔧
audioQueue.value = [];
isPlayingAudio.value = false;
currentPlayIndex = 0;
isCallingPlayNext = false;
//
audioPreloadStatus.one = { loaded: false, url: null };
audioPreloadStatus.two = { loaded: false, url: null };
audioPreloadStatus.three = { loaded: false, url: null };
audioPreloadStatus.four = { loaded: false, url: null };
//
audioStore.soundInstance = null;
audioStore.nowSound = null;
audioStore.isPlaying = false;
audioStore.isPaused = false;
audioStore.playbackPosition = 0;
console.log("消息列表已更新,最新消息:", newVal[newVal.length - 1]);
chatStore.messages.push(newVal[newVal.length - 1]);
chatStore.currentUserIndex = chatStore.messages.length - 1;
@ -1110,7 +1133,12 @@ watch(
codeData.value.name
);
}
for (let i = chatStore.messages.length - 1; i >= 0; --i) {
if (chatStore.messages[i].sender == "user") {
chatStore.messages[i].audioStatus = true;
break;
}
}
chatStore.messages.push({
class: "ing",
type: "ing",
@ -2419,6 +2447,10 @@ watch(
return;
}
try {
//
chatStore.currentUserIndex = null;
audioStore.stop(); //
//
emit("enableInput");
//
@ -4316,6 +4348,8 @@ onMounted(() => {
});
renderAllKlineCharts();
console.log("组件挂载完成");
//
chatStore.currentUserIndex = null;
chatStore.messages.forEach((item) => {
if (item.sender == "user") {

2
src/views/homePage.vue

@ -258,7 +258,7 @@ const sendMessage = async () => {
content: messageContent,
timestamp: new Date().toISOString(),
audioArray: [],
audioStatus: true,
audioStatus: false,
},
];
console.log(messages.value, "messages.value");

Loading…
Cancel
Save