diff --git a/gui/src/components/chat.vue b/gui/src/components/chat.vue index f30c5eba..8abf6eab 100644 --- a/gui/src/components/chat.vue +++ b/gui/src/components/chat.vue @@ -2,6 +2,7 @@ // @ts-nocheck // disable typescript check beacuse of error with beacon histogram options + import chat_conversations from "./chat_conversations.vue"; import chat_messages from "./chat_messages.vue"; import chat_new_message from "./chat_new_message.vue"; @@ -13,6 +14,8 @@ setActivePinia(pinia); import { useChatStore } from "../store/chatStore.js"; const chat = useChatStore(pinia); + + import { Chart as ChartJS, CategoryScale, @@ -25,7 +28,7 @@ import { } from "chart.js"; import { Bar } from "vue-chartjs"; -import { ref, computed } from "vue"; +import { watch, nextTick, ref, computed } from "vue"; import annotationPlugin from "chartjs-plugin-annotation"; ChartJS.register( @@ -101,6 +104,18 @@ const beaconHistogramData = computed(() => ({ }, ], })); + +const messagesContainer = ref(null); +watch(() => chat.scrollTrigger, (newVal, oldVal) => { + //console.log("Trigger changed from", oldVal, "to", newVal); // Debugging line + nextTick(() => { + if (messagesContainer.value) { + messagesContainer.value.scrollTop = messagesContainer.value.scrollHeight; + } + }); +}); + +