mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-10 10:16:55 +08:00
Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -182,7 +182,7 @@ class HttpService {
|
||||
setTimeout(() => {
|
||||
wsCache.delete('user.token')
|
||||
window.location.reload()
|
||||
}, 1000)
|
||||
}, 2000)
|
||||
return
|
||||
// break
|
||||
case 403:
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
:class="{ 'assistant-popover-sidebar': isAssistant }"
|
||||
>
|
||||
<el-popover
|
||||
:visible="isAssistant ? floatPopoverVisible : null"
|
||||
:width="280"
|
||||
placement="bottom-start"
|
||||
:popper-style="{ ...defaultFloatPopoverStyle }"
|
||||
@@ -48,6 +47,31 @@
|
||||
@on-click-side-bar-btn="hideSideBar"
|
||||
/>
|
||||
</el-popover>
|
||||
|
||||
<el-drawer
|
||||
v-model="floatPopoverVisible"
|
||||
:with-header="false"
|
||||
direction="ltr"
|
||||
size="278"
|
||||
modal-class="assistant-popover_sidebar"
|
||||
:before-close="hideSideBar"
|
||||
>
|
||||
<ChatListContainer
|
||||
ref="floatPopoverRef"
|
||||
v-model:chat-list="chatList"
|
||||
v-model:current-chat-id="currentChatId"
|
||||
v-model:current-chat="currentChat"
|
||||
v-model:loading="loading"
|
||||
:in-popover="false"
|
||||
@go-empty="goEmpty"
|
||||
@on-chat-created="onChatCreated"
|
||||
@on-click-history="onClickHistory"
|
||||
@on-chat-deleted="onChatDeleted"
|
||||
@on-chat-renamed="onChatRenamed"
|
||||
@on-click-side-bar-btn="hideSideBar"
|
||||
/>
|
||||
</el-drawer>
|
||||
|
||||
<el-tooltip effect="dark" :content="t('qa.new_chat')" placement="bottom">
|
||||
<el-button link type="primary" class="icon-btn" @click="createNewChatSimple">
|
||||
<el-icon>
|
||||
@@ -1092,3 +1116,15 @@ onMounted(() => {
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="less">
|
||||
.assistant-popover_sidebar {
|
||||
.ed-drawer {
|
||||
height: 100% !important;
|
||||
margin-top: 0 !important;
|
||||
}
|
||||
.ed-drawer__body {
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -77,6 +77,10 @@ const handleDefaultDatasourceChange = (item: any) => {
|
||||
}
|
||||
}
|
||||
|
||||
const changeActiveStep = (val: number) => {
|
||||
activeStep.value = val > 2 ? 2 : val
|
||||
}
|
||||
|
||||
const formatKeywords = (item: string) => {
|
||||
if (!defaultDatasourceKeywords.value) return item
|
||||
return item.replaceAll(
|
||||
@@ -359,7 +363,7 @@ const back = () => {
|
||||
:active-type="activeType"
|
||||
@refresh="refresh"
|
||||
@close="beforeClose"
|
||||
@change-active-step="(val: number) => (activeStep = val)"
|
||||
@change-active-step="changeActiveStep"
|
||||
></DatasourceForm>
|
||||
</el-drawer>
|
||||
</div>
|
||||
|
||||
@@ -9,6 +9,7 @@ import { ElMessage } from 'element-plus-secondary'
|
||||
import type { FormInstance, FormRules } from 'element-plus-secondary'
|
||||
import icon_form_outlined from '@/assets/svg/icon_form_outlined.svg'
|
||||
import FixedSizeList from 'element-plus-secondary/es/components/virtual-list/src/components/fixed-size-list.mjs'
|
||||
import { debounce } from 'lodash-es'
|
||||
import { Plus } from '@element-plus/icons-vue'
|
||||
import { useCache } from '@/utils/useCache'
|
||||
import { haveSchema } from '@/views/ds/js/ds-type'
|
||||
@@ -42,6 +43,7 @@ const tableList = ref<any>([])
|
||||
const excelUploadSuccess = ref(false)
|
||||
const tableListLoading = ref(false)
|
||||
const token = wsCache.get('user.token')
|
||||
const checkLoading = ref(false)
|
||||
const request_key = computed(() => {
|
||||
// eslint-disable-next-line no-undef
|
||||
return LicenseGenerator.generate()
|
||||
@@ -339,7 +341,7 @@ const check = () => {
|
||||
|
||||
onBeforeUnmount(() => (saveLoading.value = false))
|
||||
|
||||
const next = async (formEl: FormInstance | undefined) => {
|
||||
const next = debounce(async (formEl: FormInstance | undefined) => {
|
||||
if (!formEl) return
|
||||
await formEl.validate((valid) => {
|
||||
if (valid) {
|
||||
@@ -349,31 +351,38 @@ const next = async (formEl: FormInstance | undefined) => {
|
||||
emit('changeActiveStep', props.activeStep + 1)
|
||||
}
|
||||
} else {
|
||||
if (checkLoading.value) return
|
||||
// check status if success do next
|
||||
const requestObj = buildConf()
|
||||
datasourceApi.check(requestObj).then((res: boolean) => {
|
||||
if (res) {
|
||||
emit('changeActiveStep', props.activeStep + 1)
|
||||
// request tables
|
||||
datasourceApi.getTablesByConf(requestObj).then((res: any) => {
|
||||
tableList.value = res
|
||||
})
|
||||
} else {
|
||||
ElMessage({
|
||||
message: t('ds.form.connect.failed'),
|
||||
type: 'error',
|
||||
showClose: true,
|
||||
})
|
||||
}
|
||||
})
|
||||
checkLoading.value = true
|
||||
datasourceApi
|
||||
.check(requestObj)
|
||||
.then((res: boolean) => {
|
||||
if (res) {
|
||||
emit('changeActiveStep', props.activeStep + 1)
|
||||
// request tables
|
||||
datasourceApi.getTablesByConf(requestObj).then((res: any) => {
|
||||
tableList.value = res
|
||||
})
|
||||
} else {
|
||||
ElMessage({
|
||||
message: t('ds.form.connect.failed'),
|
||||
type: 'error',
|
||||
showClose: true,
|
||||
})
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
checkLoading.value = false
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}, 300)
|
||||
|
||||
const preview = () => {
|
||||
const preview = debounce(() => {
|
||||
emit('changeActiveStep', props.activeStep - 1)
|
||||
}
|
||||
}, 200)
|
||||
|
||||
const beforeUpload = (rawFile: any) => {
|
||||
setFile(rawFile)
|
||||
@@ -479,7 +488,7 @@ defineExpose({
|
||||
|
||||
<template>
|
||||
<div
|
||||
v-loading="uploadLoading || saveLoading"
|
||||
v-loading="uploadLoading || saveLoading || checkLoading"
|
||||
class="model-form"
|
||||
:class="(!isCreate || activeStep === 2) && 'edit-form'"
|
||||
>
|
||||
|
||||
@@ -88,6 +88,7 @@ onMounted(() => {
|
||||
}
|
||||
.ed-drawer {
|
||||
margin-top: 50px;
|
||||
height: calc(100vh - 50px) !important;
|
||||
}`
|
||||
document.querySelector('head')?.appendChild(style)
|
||||
})
|
||||
|
||||
@@ -760,6 +760,7 @@ const saveHandler = () => {
|
||||
:name="ele.name"
|
||||
:type="ele.type"
|
||||
:type-name="ele.type_name"
|
||||
:description="ele.description"
|
||||
:is-private="dsForm.private_list.includes(ele.id)"
|
||||
:num="ele.num"
|
||||
@active="handleActive(ele)"
|
||||
|
||||
@@ -35,7 +35,7 @@ const activeName = ref('')
|
||||
const activeType = ref('')
|
||||
const modelFormRef = ref()
|
||||
const cardRefs = ref<any[]>([])
|
||||
const showCardError = ref(true) // if you don`t want card mask error, just change this to false
|
||||
// const showCardError = ref(true) // if you don`t want card mask error, just change this to false
|
||||
reactive({
|
||||
form: {
|
||||
id: '',
|
||||
@@ -71,6 +71,8 @@ const defaultModelListWithSearch = computed(() => {
|
||||
})
|
||||
|
||||
const modelCheckHandler = async (item: any) => {
|
||||
console.log(item)
|
||||
/**
|
||||
const response = await modelApi.check(item)
|
||||
const reader = response.body.getReader()
|
||||
const decoder = new TextDecoder()
|
||||
@@ -110,6 +112,7 @@ const modelCheckHandler = async (item: any) => {
|
||||
currentRef?.showErrorMask(checkMsg)
|
||||
}
|
||||
})
|
||||
*/
|
||||
}
|
||||
const duplicateName = async (item: any) => {
|
||||
const res = await modelApi.queryAll()
|
||||
|
||||
Reference in New Issue
Block a user