Browse Source

去除情绪大模型自动滚动设置,只在夺宝奇兵大模型自动滚动。

dev
宋杰 3 days ago
parent
commit
7b4bdbc1e0
  1. 63
      src/views/AiEmotion.vue
  2. 4
      src/views/homePage.vue

63
src/views/AiEmotion.vue

@ -258,8 +258,6 @@ const hasTriggeredAudio = ref(false); // 是否已触发音频播放
const hasTriggeredTypewriter = ref(false); // const hasTriggeredTypewriter = ref(false); //
const intersectionObserver = ref(null); // observer const intersectionObserver = ref(null); // observer
const isUserInitiated = ref(false); // const isUserInitiated = ref(false); //
const isUserScrolling = ref(false); //
const scrollTimeout = ref(null); //
// //
const displayedTexts = ref({ const displayedTexts = ref({
@ -846,10 +844,7 @@ function playAudio(url) {
isAudioPlaying.value = true; isAudioPlaying.value = true;
emotionAudioStore.isPlaying = true; emotionAudioStore.isPlaying = true;
console.log('开始播放场景应用语音'); console.log('开始播放场景应用语音');
//
// setTimeout(() => {
// scrollToBottom();
// }, 100);
//
}, },
onend: () => { onend: () => {
isAudioPlaying.value = false; isAudioPlaying.value = false;
@ -1518,36 +1513,11 @@ function renderCharts(data) {
}); });
} }
// const scrollToBottom = async () => {
// //
// if (isUserScrolling.value) {
// console.log('');
// return;
// }
// scrollToBottom
// const container = userInputDisplayRef.value;
// if (!container) return;
// await nextTick();
// console.log(container.scrollHeight, "container.scrollHeight");
// console.log(container.scrollTop, "container.scrollTop");
// console.log(container.offsetHeight, "container.offsetHeight");
// container.scrollTop = container.scrollHeight - container.offsetHeight;
// };
//
//
const handleUserScroll = () => { const handleUserScroll = () => {
isUserScrolling.value = true;
//
if (scrollTimeout.value) {
clearTimeout(scrollTimeout.value);
}
// 2
scrollTimeout.value = setTimeout(() => {
isUserScrolling.value = false;
console.log('用户滚动结束,重新允许自动滚动');
}, 2000);
//
}; };
// //
@ -1589,16 +1559,11 @@ function isDataLoaded() {
return false; return false;
} }
console.log('所有数据和组件已加载完成,可以开始滚动');
console.log('所有数据和组件已加载完成');
return true; return true;
} }
//
function startAutoScroll() {
//
console.log('自动滚动功能已被禁用');
return;
}
//
// Intersection Observer // Intersection Observer
function setupIntersectionObserver() { function setupIntersectionObserver() {
@ -1690,12 +1655,7 @@ function setupIntersectionObserver() {
intersectionObserver.value = observer; intersectionObserver.value = observer;
} }
//
function triggerAutoScroll() {
//
console.log('自动滚动功能已被禁用');
return;
}
//
// //
const scrollToTop = () => { const scrollToTop = () => {
@ -1911,11 +1871,7 @@ onUnmounted(() => {
window.removeEventListener('scroll', handlePageScroll); window.removeEventListener('scroll', handlePageScroll);
document.removeEventListener('scroll', handlePageScroll); document.removeEventListener('scroll', handlePageScroll);
//
if (scrollTimeout.value) {
clearTimeout(scrollTimeout.value);
scrollTimeout.value = null;
}
//
}); });
// //
@ -1923,8 +1879,7 @@ const emit = defineEmits(['updateMessage', 'sendMessage', 'ensureAIchat']);
// 使 // 使
defineExpose({ defineExpose({
handleSendMessage,
triggerAutoScroll
handleSendMessage
}); });
</script> </script>

4
src/views/homePage.vue

@ -287,7 +287,10 @@ watch(
() => chatStore.messages, () => chatStore.messages,
() => { () => {
// console.log('messages') // console.log('messages')
// AIchat
if (activeTab.value === "AIchat") {
throttledSmoothScrollToBottom(); throttledSmoothScrollToBottom();
}
// setTimeout(throttledSmoothScrollToBottom, 100); // setTimeout(throttledSmoothScrollToBottom, 100);
}, },
{ deep: true, immediate: true } { deep: true, immediate: true }
@ -303,6 +306,7 @@ watch(
throttledSmoothScrollToBottom(); throttledSmoothScrollToBottom();
}, 100); }, 100);
} }
// AiEmotion
// setTimeout(throttledSmoothScrollToBottom, 100); // setTimeout(throttledSmoothScrollToBottom, 100);
}, },
{ deep: true, immediate: true } { deep: true, immediate: true }

Loading…
Cancel
Save