From 176f78fea964650c9a6aa7f3c54405259e73b9ca Mon Sep 17 00:00:00 2001 From: dataeaseShu Date: Fri, 4 Jul 2025 16:22:02 +0800 Subject: [PATCH] feat(chat): Open Question Number --- frontend/src/views/chat/ChatCreator.vue | 5 +++++ frontend/src/views/ds/Card.vue | 8 ++++---- frontend/src/views/ds/Datasource.vue | 20 +++++++++++++++++--- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/frontend/src/views/chat/ChatCreator.vue b/frontend/src/views/chat/ChatCreator.vue index 1430a78f..d9663c65 100644 --- a/frontend/src/views/chat/ChatCreator.vue +++ b/frontend/src/views/chat/ChatCreator.vue @@ -3,6 +3,7 @@ import { chatApi, ChatInfo } from '@/api/chat.ts' import { onMounted, ref } from 'vue' import { datasourceApi } from '@/api/datasource.ts' import DatasourceItemCard from '../ds/DatasourceItemCard.vue' +import { useRoute } from 'vue-router' const dsList = ref>([]) @@ -13,6 +14,7 @@ function listDs() { dsList.value = res }) } +const route = useRoute() const dialogVisible = ref(false) @@ -66,6 +68,9 @@ function createChat(datasource: number) { onMounted(() => { listDs() + const id = route.query.id as unknown as number + if (!id) return + createChat(id) }) defineExpose({ diff --git a/frontend/src/views/ds/Card.vue b/frontend/src/views/ds/Card.vue index 73fdbf7e..5dae8cc1 100644 --- a/frontend/src/views/ds/Card.vue +++ b/frontend/src/views/ds/Card.vue @@ -12,6 +12,7 @@ const props = withDefaults( defineProps<{ name: string type: string + type_name: string rate?: string description?: string id?: string @@ -19,13 +20,13 @@ const props = withDefaults( { name: '-', type: '-', - rate: '-', description: '-', id: '-', + type_name: '-', } ) -const emits = defineEmits(['edit', 'del', 'question', 'dataTableDetail']) +const emits = defineEmits(['edit', 'del', 'question', 'dataTableDetail', 'showTable']) const icon = computed(() => { return (dsTypeWithImg.find((ele) => props.type === ele.type) || {}).img }) @@ -57,7 +58,7 @@ const onClickOutside = () => {
{{ name }}
-
{{ type }}
+
{{ type_name }}
@@ -69,7 +70,6 @@ const onClickOutside = () => { - {{ rate }}
diff --git a/frontend/src/views/ds/Datasource.vue b/frontend/src/views/ds/Datasource.vue index b2836684..9881dad4 100644 --- a/frontend/src/views/ds/Datasource.vue +++ b/frontend/src/views/ds/Datasource.vue @@ -5,6 +5,7 @@ import icon_searchOutline_outlined from '@/assets/svg/icon_search-outline_outlin import arrow_down from '@/assets/svg/arrow-down.svg' import icon_add_outlined from '@/assets/svg/icon_add_outlined.svg' import EmptyBackground from '@/views/dashboard/common/EmptyBackground.vue' +import { useRouter } from 'vue-router' import DataTable from './DataTable.vue' import icon_done_outlined from '@/assets/svg/icon_done_outlined.svg' import icon_close_outlined from '@/assets/svg/operate/ope-close.svg' @@ -18,12 +19,14 @@ import { useI18n } from 'vue-i18n' interface Datasource { name: string + type_name: string type: string img: string - rate?: string + description: string id?: string } +const router = useRouter() const { t } = useI18n() const keywords = ref('') const defaultDatasourceKeywords = ref('') @@ -75,6 +78,15 @@ const handleEditDatasource = (res: any) => { }) } +const handleQuestion = (id: string) => { + router.push({ + path: '/chat/index', + query: { + id, + }, + }) +} + const handleAddDatasource = () => { editDatasource.value = false datasourceConfigvVisible.value = true @@ -208,7 +220,7 @@ const dataTableDetail = (ele: any) => {
- 没有找到相关结果 + {{ t('model.relevant_results_found') }}
@@ -235,7 +247,9 @@ const dataTableDetail = (ele: any) => { :key="ele.id" :name="ele.name" :type="ele.type" - :rate="ele.rate" + :type_name="ele.type_name" + :description="ele.description" + @question="handleQuestion" @edit="handleEditDatasource(ele)" @del="deleteHandler(ele)" @data-table-detail="dataTableDetail(ele)"