Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions frontend/src/views/embedded/page.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<template>
<div :class="dynamicType === 4 ? 'sqlbot--embedded-page' : 'sqlbot-embedded-assistant-page'">
<div
v-loading="divLoading"
:class="dynamicType === 4 ? 'sqlbot--embedded-page' : 'sqlbot-embedded-assistant-page'"
>
<chat-component
v-if="!loading"
ref="chatRef"
Expand All @@ -13,7 +16,7 @@
</template>
<script setup lang="ts">
import ChatComponent from '@/views/chat/index.vue'
import { nextTick, onBeforeMount, onBeforeUnmount, reactive, ref } from 'vue'
import { nextTick, onBeforeMount, onBeforeUnmount, reactive, ref, watch } from 'vue'
import { useRoute } from 'vue-router'
import { assistantApi } from '@/api/assistant'
import { useAssistantStore } from '@/stores/assistant'
Expand Down Expand Up @@ -47,6 +50,7 @@ const validator = ref({
token: '',
})
const loading = ref(true)
const divLoading = ref(true)
const eventName = 'sqlbot_embedded_event'
const communicationCb = async (event: any) => {
if (event.data?.eventName === eventName) {
Expand Down Expand Up @@ -80,6 +84,17 @@ const communicationCb = async (event: any) => {
}
}
}

watch(
() => loading.value,
(val) => {
nextTick(() => {
setTimeout(() => {
divLoading.value = val
}, 1000)
})
}
)
const createChat = () => {
chatRef.value?.createNewChat()
}
Expand Down