|
@ -156,6 +156,9 @@ const playAudioSequence = (audioUrls) => { |
|
|
audioStore.isPlaying = false; |
|
|
audioStore.isPlaying = false; |
|
|
audioStore.isPaused = false; |
|
|
audioStore.isPaused = false; |
|
|
audioStore.playbackPosition = 0; |
|
|
audioStore.playbackPosition = 0; |
|
|
|
|
|
// 清除音频实例,确保下次点击从头开始 |
|
|
|
|
|
audioStore.soundInstance = null; |
|
|
|
|
|
audioStore.nowSound = null; |
|
|
if (audioSequence.length > 0) { |
|
|
if (audioSequence.length > 0) { |
|
|
audioStore.setCurrentAudioUrl(audioSequence[0]); |
|
|
audioStore.setCurrentAudioUrl(audioSequence[0]); |
|
|
} |
|
|
} |
|
@ -230,22 +233,33 @@ const playAudioSequence = (audioUrls) => { |
|
|
// 重写togglePlayPause方法以支持音频序列控制 |
|
|
// 重写togglePlayPause方法以支持音频序列控制 |
|
|
const originalTogglePlayPause = audioStore.togglePlayPause; |
|
|
const originalTogglePlayPause = audioStore.togglePlayPause; |
|
|
audioStore.togglePlayPause = () => { |
|
|
audioStore.togglePlayPause = () => { |
|
|
|
|
|
console.log('音频控制按钮被点击'); |
|
|
|
|
|
console.log('当前播放状态:', audioStore.isPlaying); |
|
|
|
|
|
console.log('当前暂停状态:', audioStore.isPaused); |
|
|
|
|
|
console.log('当前音频实例:', audioStore.soundInstance); |
|
|
|
|
|
console.log('当前索引:', currentIndex, '音频序列长度:', audioSequence.length); |
|
|
|
|
|
|
|
|
if (audioStore.soundInstance) { |
|
|
if (audioStore.soundInstance) { |
|
|
if (audioStore.isPlaying) { |
|
|
if (audioStore.isPlaying) { |
|
|
// 暂停当前音频 |
|
|
// 暂停当前音频 |
|
|
|
|
|
console.log('暂停当前音频'); |
|
|
audioStore.pause(); |
|
|
audioStore.pause(); |
|
|
} else if (audioStore.isPaused) { |
|
|
} else if (audioStore.isPaused) { |
|
|
// 从暂停位置继续播放 |
|
|
// 从暂停位置继续播放 |
|
|
|
|
|
console.log('从暂停位置继续播放'); |
|
|
audioStore.play(); |
|
|
audioStore.play(); |
|
|
} else { |
|
|
} else { |
|
|
// 重新开始播放当前音频或从头开始播放序列 |
|
|
// 重新开始播放当前音频或从头开始播放序列 |
|
|
|
|
|
console.log('重新开始播放,当前索引:', currentIndex); |
|
|
if (currentIndex >= audioSequence.length) { |
|
|
if (currentIndex >= audioSequence.length) { |
|
|
|
|
|
console.log('所有音频已播放完成,从头开始'); |
|
|
currentIndex = 0; // 重置到第一个音频 |
|
|
currentIndex = 0; // 重置到第一个音频 |
|
|
} |
|
|
} |
|
|
playNext(); |
|
|
playNext(); |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
// 没有音频实例时,从头开始播放 |
|
|
// 没有音频实例时,从头开始播放 |
|
|
|
|
|
console.log('没有音频实例,从头开始播放'); |
|
|
currentIndex = 0; |
|
|
currentIndex = 0; |
|
|
playNext(); |
|
|
playNext(); |
|
|
} |
|
|
} |
|
@ -467,7 +481,7 @@ const processTypingQueue = async () => { |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
// 添加打字机任务到队列 |
|
|
// 添加打字机任务到队列 |
|
|
const addTypingTask = (message, content, speed = 50) => { |
|
|
|
|
|
|
|
|
const addTypingTask = (message, content, speed) => { |
|
|
typingQueue.value.push({ message, content, speed }); |
|
|
typingQueue.value.push({ message, content, speed }); |
|
|
processTypingQueue(); |
|
|
processTypingQueue(); |
|
|
}; |
|
|
}; |
|
@ -856,7 +870,7 @@ watch( |
|
|
// } |
|
|
// } |
|
|
// }, 50); // 调整速度为50ms/字符 |
|
|
// }, 50); // 调整速度为50ms/字符 |
|
|
|
|
|
|
|
|
addTypingTask(aiMessage1, ["", ac1], 50); |
|
|
|
|
|
|
|
|
addTypingTask(aiMessage1, ["", ac1], 130); |
|
|
|
|
|
|
|
|
// chatStore.messages.push({ |
|
|
// chatStore.messages.push({ |
|
|
// sender: "ai", |
|
|
// sender: "ai", |
|
@ -1090,7 +1104,7 @@ watch( |
|
|
// aiMessage2.isTyping = false; |
|
|
// aiMessage2.isTyping = false; |
|
|
// } |
|
|
// } |
|
|
// }, 50); // 调整速度为50ms/字符 |
|
|
// }, 50); // 调整速度为50ms/字符 |
|
|
addTypingTask(aiMessage2, ["", ac2], 50); |
|
|
|
|
|
|
|
|
addTypingTask(aiMessage2, ["", ac2], 130); |
|
|
|
|
|
|
|
|
// chatStore.messages.push({ |
|
|
// chatStore.messages.push({ |
|
|
// sender: "ai", |
|
|
// sender: "ai", |
|
@ -1172,7 +1186,7 @@ watch( |
|
|
|
|
|
|
|
|
// } |
|
|
// } |
|
|
// }, 50); // 调整速度为50ms/字符 |
|
|
// }, 50); // 调整速度为50ms/字符 |
|
|
addTypingTask(aiMessage3, [ac31, ac32], 50); |
|
|
|
|
|
|
|
|
addTypingTask(aiMessage3, [ac31, ac32], 180); |
|
|
|
|
|
|
|
|
// chatStore.messages.push({ |
|
|
// chatStore.messages.push({ |
|
|
// sender: "ai", |
|
|
// sender: "ai", |
|
@ -1253,7 +1267,7 @@ watch( |
|
|
addTypingTask( |
|
|
addTypingTask( |
|
|
aiMessage4, |
|
|
aiMessage4, |
|
|
[ac41, ac42, ac43, ac44, ac45, ac46, ac47, ac48], |
|
|
[ac41, ac42, ac43, ac44, ac45, ac46, ac47, ac48], |
|
|
50 |
|
|
|
|
|
|
|
|
180 |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
// chatStore.messages.push({ |
|
|
// chatStore.messages.push({ |
|
@ -1337,7 +1351,7 @@ watch( |
|
|
|
|
|
|
|
|
// } |
|
|
// } |
|
|
// }, 50); // 调整速度为50ms/字符 |
|
|
// }, 50); // 调整速度为50ms/字符 |
|
|
addTypingTask(aiMessage5, [ac51, ac52, ac53, ac54], 50); |
|
|
|
|
|
|
|
|
addTypingTask(aiMessage5, [ac51, ac52, ac53, ac54], 180); |
|
|
|
|
|
|
|
|
// chatStore.messages.push({ |
|
|
// chatStore.messages.push({ |
|
|
// sender: "ai", |
|
|
// sender: "ai", |
|
@ -1368,7 +1382,7 @@ watch( |
|
|
|
|
|
|
|
|
// } |
|
|
// } |
|
|
// }, 50); // 调整速度为50ms/字符 |
|
|
// }, 50); // 调整速度为50ms/字符 |
|
|
addTypingTask(aiMessage6, ["", ac6], 100); |
|
|
|
|
|
|
|
|
addTypingTask(aiMessage6, ["", ac6], 180); |
|
|
|
|
|
|
|
|
// chatStore.messages.push({ |
|
|
// chatStore.messages.push({ |
|
|
// sender: "ai", |
|
|
// sender: "ai", |
|
|