Skip to content

Commit a4fe2b1

Browse files
committed
chore: add template for spacer
1 parent 5dd0c73 commit a4fe2b1

3 files changed

Lines changed: 20 additions & 3 deletions

File tree

custom/ChatSurface.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ onMounted(async () => {
254254
agentStore.setIsTeleportedToBody(isTeleportedToBodyFromLocalStorage || props.meta.stickByDefault);
255255
}
256256
await agentStore.fetchSessionsList();
257+
agentStore.setFullScreen(true);
257258
});
258259
259260
function autoResize() {

custom/CustomAutoScrollContainer.vue

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,16 @@
1111
</template>
1212

1313
<script setup lang="ts">
14-
import { ref, onMounted, onUnmounted, nextTick, watch } from 'vue'
14+
import { ref, onMounted, onUnmounted, nextTick, computed } from 'vue'
1515
import CustomScrollbar from 'custom-vue-scrollbar';
1616
import 'custom-vue-scrollbar/dist/style.css';
1717
import { useAgentStore } from './composables/useAgentStore';
1818
19-
const agentStore = useAgentStore();
19+
const scrollParams = ref({
20+
scrollTop: 0,
21+
scrollHeight: 0,
22+
clientHeight: 0
23+
});
2024
2125
const props = withDefaults(defineProps<{
2226
enabled?: boolean
@@ -42,6 +46,9 @@ function isNearBottom(): boolean {
4246
if (!container) return true
4347
4448
const { scrollTop, scrollHeight, clientHeight } = container
49+
scrollParams.value.scrollTop = scrollTop
50+
scrollParams.value.scrollHeight = scrollHeight
51+
scrollParams.value.clientHeight = clientHeight
4552
return scrollHeight - scrollTop - clientHeight <= props.threshold
4653
}
4754
@@ -107,6 +114,9 @@ onMounted(() => {
107114
}
108115
109116
lastScrollHeight = containerRef.value.scrollEl.scrollHeight
117+
scrollParams.value.scrollTop = containerRef.value.scrollEl.scrollTop
118+
scrollParams.value.scrollHeight = containerRef.value.scrollEl.scrollHeight
119+
scrollParams.value.clientHeight = containerRef.value.scrollEl.clientHeight
110120
if (props.enabled && !isUserScrolledUp.value) {
111121
scrollToBottom()
112122
}
@@ -128,7 +138,8 @@ defineExpose({
128138
scrollToBottom: () => scrollToBottom(true),
129139
isUserScrolledUp: () => isUserScrolledUp.value,
130140
container: containerRef,
131-
handleScroll
141+
handleScroll,
142+
scrollParams
132143
})
133144
</script>
134145

custom/conversation_area/ConversationArea.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
<p>{{ $t('Start the conversation') }}</p>
5252
<p class="tracking-normal text-base text">{{ $t('Give any input to begin') }}</p>
5353
</div>
54+
<div></div>
5455
</CustomAutoScrollContainer>
5556
<button @click="scrollContainer.scrollToBottom();">
5657
<IconArrowDownOutline
@@ -84,6 +85,10 @@ const agentStore = useAgentStore();
8485
const agentTransitions = useAgentTransitions();
8586
const showScrollContainer = ref(true);
8687
88+
const scrollHeight = computed(() => {
89+
return scrollContainer.value ? scrollContainer.value.scrollParams.scrollHeight : 0;
90+
});
91+
8792
function recalculateScroll() {
8893
if (scrollContainer.value) {
8994
scrollContainer.value.handleScroll(false);

0 commit comments

Comments
 (0)