From 8033f9d459f5288cf3814cee0831f41094cc8589 Mon Sep 17 00:00:00 2001 From: ulleo Date: Wed, 11 Jun 2025 18:06:56 +0800 Subject: [PATCH] feat: chat select datasource --- frontend/src/views/chat/WelcomeBlock.vue | 52 +++++++++++++++++++++--- 1 file changed, 47 insertions(+), 5 deletions(-) diff --git a/frontend/src/views/chat/WelcomeBlock.vue b/frontend/src/views/chat/WelcomeBlock.vue index ba90a7d8..6be01603 100644 --- a/frontend/src/views/chat/WelcomeBlock.vue +++ b/frontend/src/views/chat/WelcomeBlock.vue @@ -4,8 +4,9 @@ import {ChatInfo} from "@/api/chat.ts"; import {computed, onMounted, ref} from "vue"; import {datasourceApi} from "@/api/datasource.ts"; import DatasourceItemCard from '../ds/DatasourceItemCard.vue' -import { useI18n } from 'vue-i18n' -const { t } = useI18n() +import {useI18n} from 'vue-i18n' + +const {t} = useI18n() const props = withDefaults(defineProps<{ modelValue?: number currentChat: ChatInfo @@ -50,9 +51,27 @@ function listDs() { }) } -function showDs() { - listDs() +const dialogVisible = ref(false) +const DatasourceListRef = ref() + +const innerDs = ref() + +function showDs() { + innerDs.value = props.modelValue + listDs() + dialogVisible.value = true +} + +function selectDsInDialog(ds: any) { + innerDs.value = ds.id +} + +function comfirmSelectDs() { + if (innerDs.value) { + emits("update:modelValue", innerDs.value) + dialogVisible.value = false + } } @@ -75,7 +94,7 @@ onMounted(() => {
@@ -93,6 +112,28 @@ onMounted(() => { + + + + +
+ +
+
+ +
+ @@ -126,6 +167,7 @@ onMounted(() => { .ds-card-selected { box-shadow: 0 1px 3px var(--ed-color-primary-light-5); + border: 1px solid var(--ed-color-primary-light-5); }