fix: SQLBot 嵌入 一段时间不操作后再进行问数失败

This commit is contained in:
fit2cloud-chenyw
2025-09-10 18:10:26 +08:00
committed by fit2cloud-chenyw
parent 0086544117
commit 5989ffbea6
2 changed files with 22 additions and 3 deletions

View File

@@ -436,7 +436,7 @@ public class DatasetSQLBotManage {
if (ObjectUtils.isEmpty(dsConfig) || StringUtils.isBlank(dsConfig.toString())) {
return null;
}
String dsHost = environment.getProperty("dataease.dsHost", String.class);
String dsHost = environment.getProperty("dataease.ds-host", String.class);
if (StringUtils.isBlank(dsHost)) {
dsHost = environment.getProperty("dataease.dataease-servers", String.class);
}

View File

@@ -7,7 +7,7 @@
</template>
<script lang="ts" setup>
import { onMounted, reactive, ref } from 'vue'
import { onMounted, onUnmounted, reactive, ref } from 'vue'
import request from '@/config/axios'
const loading = ref(true)
const state = reactive({
@@ -16,6 +16,8 @@ const state = reactive({
enabled: false,
valid: false
})
const sqlbotExist = ref(false)
const timer = ref()
const loadSqlbotInfo = () => {
const url = '/sysParameter/sqlbot'
@@ -60,19 +62,36 @@ const loadSqlbotPage = () => {
}
const mountedEmbeddedPage = () => {
setTimeout(() => {
if (sqlbotExist.value) {
return
}
const tempTimer = setTimeout(() => {
if (window['sqlbot_embedded_handler']) {
window['sqlbot_embedded_handler'].mounted('#dataease-v2-embedded-sqlbot', {
embeddedId: state.id,
online: true
})
loading.value = false
sqlbotExist.value = true
if (tempTimer) {
clearTimeout(tempTimer)
}
}
}, 2000)
}
onMounted(() => {
loadSqlbotInfo()
timer.value = setInterval(() => {
loadSqlbotInfo()
}, 30000)
})
onUnmounted(() => {
if (timer.value) {
clearInterval(timer.value)
timer.value = null
}
})
</script>