diff --git a/app/components/Assistant/index.vue b/app/components/Assistant/index.vue index a2606940..5d8ca112 100644 --- a/app/components/Assistant/index.vue +++ b/app/components/Assistant/index.vue @@ -56,7 +56,7 @@ function onStopStreaming() {
+const route = useRoute() +const nuxtApp = useNuxtApp() + +// Handle scroll reset on page navigation finish +nuxtApp.hook('page:finish', () => { + nextTick(() => { + // Check if there is a hash + if (route.hash) { + const el = document.querySelector(route.hash) + if (el) { + el.scrollIntoView({ behavior: 'smooth' }) + } + } else { + // Reset scroll to top if no hash + const el = document.getElementById('dashboard-panel-main') + if (el) { + el.scrollTop = 0 + } + } + }) +}) + +watch(() => route.hash, (hash) => { + if (hash) { + nextTick(() => { + const el = document.querySelector(hash) + if (el) { + el.scrollIntoView({ behavior: 'smooth' }) + } + }) + } +}) + +onMounted(() => { + if (route.hash) { + nextTick(() => { + const el = document.querySelector(route.hash) + if (el) { + el.scrollIntoView({ behavior: 'smooth' }) + } + }) + } +}) + +