Browse Source

深度九大模型滚动到底部的逻辑

dev
no99 7 days ago
parent
commit
20681d05a0
  1. 10
      src/views/deepNine.vue
  2. 24
      src/views/homePage.vue

10
src/views/deepNine.vue

@ -722,7 +722,7 @@ const createTypingEffect = (message, content, speed) => {
} }
} }
if (message.end) { if (message.end) {
chatStore.getUserCount();
homepageChatStore.getUserCount();
chatStore.isLoading = false; chatStore.isLoading = false;
console.log("打印完毕,接触输入框禁用状态"); console.log("打印完毕,接触输入框禁用状态");
chatStore.chatInput = false; chatStore.chatInput = false;
@ -1874,15 +1874,9 @@ watch(
console.error("请求失败:", e); console.error("请求失败:", e);
chatStore.firstAPICall = false; chatStore.firstAPICall = false;
hasValidData.value = false; // hasValidData.value = false; //
// chatStore.messages.pop();
// chatStore.messages.push({
// sender: "ai",
// content: "AI... ",
// });
// chatStore.setLoading(false);
} finally { } finally {
// chatStore.setLoading(false); // chatStore.setLoading(false);
await chatStore.getUserCount();
await homepageChatStore.getUserCount();
} }
} }
} }

24
src/views/homePage.vue

@ -61,6 +61,7 @@ const historyRecordRef = ref(null);
const { getQueryVariable, setActiveTabIndex, getUserInfo } = useDataStore(); const { getQueryVariable, setActiveTabIndex, getUserInfo } = useDataStore();
const dataStore = useDataStore(); const dataStore = useDataStore();
const chatStore = useChatStore(); const chatStore = useChatStore();
const deepNineStore = useDeepNineStore();
// //
// //
const emotionAudioStore = useEmotionAudioStore(); const emotionAudioStore = useEmotionAudioStore();
@ -588,21 +589,13 @@ const getCurrentScrollContainer = () => {
}; };
const smoothScrollToBottom = async () => { const smoothScrollToBottom = async () => {
// console.log("");
// await nextTick();
const container = getCurrentScrollContainer(); const container = getCurrentScrollContainer();
// console.log(container, 'container')
// console.log(isScrolling.value, 'isScrolling.value')
if (!container) return; if (!container) return;
await nextTick(); // DOM await nextTick(); // DOM
if (!isScrolling.value) { if (!isScrolling.value) {
container.scrollTop = container.scrollHeight - container.offsetHeight; container.scrollTop = container.scrollHeight - container.offsetHeight;
// container.scrollTop = container.scrollHeight;
// container.scrollTop = container.offsetHeight;
// container.scrollTop = container.scrollHeight + container.offsetHeight;
// console.log(container.scrollHeight, container.offsetHeight, container.scrollHeight - container.offsetHeight, container.scrollTop, "", "", "")
} }
}; };
@ -811,7 +804,18 @@ watch(
if (activeTab.value === "AIchat" || activeTab.value === "deepNine") { if (activeTab.value === "AIchat" || activeTab.value === "deepNine") {
throttledSmoothScrollToBottom(); throttledSmoothScrollToBottom();
} }
// setTimeout(throttledSmoothScrollToBottom, 100);
},
{ deep: false, immediate: true }
);
watch(
() => deepNineStore.messages.length,
() => {
// console.log('messages')
// AIchat
if (activeTab.value === "AIchat" || activeTab.value === "deepNine") {
throttledSmoothScrollToBottom();
}
}, },
{ deep: false, immediate: true } { deep: false, immediate: true }
); );
@ -876,8 +880,6 @@ watch(
// AiEmotion // AiEmotion
stopAiEmotionHeightObserver(); stopAiEmotionHeightObserver();
} }
// AiEmotion
// setTimeout(throttledSmoothScrollToBottom, 100);
}, },
{ deep: true, immediate: true } { deep: true, immediate: true }
); );

Loading…
Cancel
Save