mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-08 01:06:59 +08:00
perf: Optimize DataEase integration with Advanced Assistant
This commit is contained in:
committed by
fit2cloud-chenyw
parent
e626d13971
commit
b9ce9d3ddf
@@ -195,7 +195,7 @@ async def ds(session: SessionDep, current_assistant: CurrentAssistant):
|
||||
out_ds_instance: AssistantOutDs = AssistantOutDsFactory.get_instance(current_assistant)
|
||||
return [
|
||||
{
|
||||
"id": ds.id,
|
||||
"id": str(ds.id),
|
||||
"name": ds.name,
|
||||
"description": ds.description or ds.comment,
|
||||
"type": ds.type,
|
||||
|
||||
@@ -240,10 +240,13 @@ class AssistantOutDs:
|
||||
except Exception as e:
|
||||
raise Exception(
|
||||
f"Failed to encrypt {attr} for datasource {ds_dict.get('name')}, error: {str(e)}")
|
||||
for attr in attr_list:
|
||||
if attr in ds_dict:
|
||||
id_marker += str(ds_dict.get(attr, '')) + '--sqlbot--'
|
||||
id = string_to_numeric_hash(id_marker)
|
||||
|
||||
id = ds_dict.get('id', None)
|
||||
if not id:
|
||||
for attr in attr_list:
|
||||
if attr in ds_dict:
|
||||
id_marker += str(ds_dict.get(attr, '')) + '--sqlbot--'
|
||||
id = string_to_numeric_hash(id_marker)
|
||||
db_schema = ds_dict.get('schema', ds_dict.get('db_schema', ''))
|
||||
ds_dict.pop("schema", None)
|
||||
return AssistantOutDsSchema(**{**ds_dict, "id": id, "db_schema": db_schema})
|
||||
|
||||
@@ -107,7 +107,10 @@ class HttpService {
|
||||
!!(assistantStore.getType % 2) &&
|
||||
assistantStore.getCertificate
|
||||
) {
|
||||
if (config.method?.toLowerCase() === 'get' && /\/chat\/\d+$/.test(config.url || '')) {
|
||||
if (
|
||||
(config.method?.toLowerCase() === 'get' && /\/chat\/\d+$/.test(config.url || '')) ||
|
||||
config.url?.includes('/system/assistant/ds')
|
||||
) {
|
||||
await assistantStore.refreshCertificate()
|
||||
}
|
||||
config.headers['X-SQLBOT-ASSISTANT-CERTIFICATE'] = btoa(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, ref, computed, shallowRef } from 'vue'
|
||||
import { onMounted, ref, computed, shallowRef, onBeforeUnmount, onBeforeMount } from 'vue'
|
||||
import icon_close_outlined from '@/assets/svg/operate/ope-close.svg'
|
||||
import icon_add_outlined from '@/assets/svg/icon_add_outlined.svg'
|
||||
import EmptyBackground from '@/views/dashboard/common/EmptyBackground.vue'
|
||||
@@ -123,12 +123,26 @@ function createChat(datasource: number) {
|
||||
})
|
||||
}
|
||||
|
||||
const drawerHeight = ref(0)
|
||||
const setHeight = () => {
|
||||
drawerHeight.value = document.body.clientHeight - 100
|
||||
console.log(drawerHeight.value)
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
if (props.hidden) {
|
||||
return
|
||||
}
|
||||
})
|
||||
|
||||
onBeforeMount(() => {
|
||||
setHeight()
|
||||
window.addEventListener('resize', setHeight)
|
||||
})
|
||||
onBeforeUnmount(() => {
|
||||
window.removeEventListener('resize', setHeight)
|
||||
})
|
||||
|
||||
const handleAddDatasource = () => {
|
||||
addDrawerRef.value.handleAddDatasource()
|
||||
}
|
||||
@@ -145,7 +159,7 @@ defineExpose({
|
||||
<el-drawer
|
||||
v-model="datasourceConfigVisible"
|
||||
:close-on-click-modal="false"
|
||||
size="calc(100% - 100px)"
|
||||
:size="drawerHeight"
|
||||
modal-class="datasource-drawer-chat"
|
||||
direction="btt"
|
||||
:before-close="beforeClose"
|
||||
|
||||
@@ -57,6 +57,6 @@ onMounted(() => {
|
||||
background: #f7f8fa;
|
||||
box-sizing: border-box;
|
||||
overflow: auto;
|
||||
padding-bottom: 48px;
|
||||
// padding-bottom: 48px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -235,6 +235,6 @@ onBeforeUnmount(() => {
|
||||
background: #f7f8fa;
|
||||
box-sizing: border-box;
|
||||
overflow: auto;
|
||||
padding-bottom: 48px;
|
||||
//padding-bottom: 48px;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user