|
|
@@ -154,6 +154,8 @@ const CONSTANTS = {
|
|
|
const router = useRouter() // 获取当前路由对象
|
|
|
// 渲染页面标题
|
|
|
const boxIconTitle = ref('')
|
|
|
+// AI组件refs
|
|
|
+const aiTextToText = ref(null)
|
|
|
// 音频播放器实例
|
|
|
const { stopPlayback } = useAudioPlayer();
|
|
|
// 定义组件的props
|
|
|
@@ -221,6 +223,11 @@ const playPreviousVideo = () => {
|
|
|
if (currentIndex > 0) {
|
|
|
// 停止音频播放并清理资源
|
|
|
stopPlayback();
|
|
|
+ // 终止AI问答流并清空消息列表
|
|
|
+ if (aiTextToText.value) {
|
|
|
+ aiTextToText.value.stopStream();
|
|
|
+ aiTextToText.value.clearMessageList();
|
|
|
+ }
|
|
|
const previousCourse = props.courseList[currentIndex - 1]
|
|
|
// 更新当前课程数据
|
|
|
handleParentCourseData(previousCourse)
|
|
|
@@ -238,6 +245,11 @@ const playNextVideo = () => {
|
|
|
if (currentIndex !== -1 && currentIndex < props.courseList.length - 1) {
|
|
|
// 停止音频播放并清理资源
|
|
|
stopPlayback();
|
|
|
+ // 终止AI问答流并清空消息列表
|
|
|
+ if (aiTextToText.value) {
|
|
|
+ aiTextToText.value.stopStream();
|
|
|
+ aiTextToText.value.clearMessageList();
|
|
|
+ }
|
|
|
const nextCourse = props.courseList[currentIndex + 1]
|
|
|
// 更新当前课程数据
|
|
|
handleParentCourseData(nextCourse)
|