Skip to content

Commit 176f78f

Browse files
committed
feat(chat): Open Question Number
1 parent 7b4d7f5 commit 176f78f

File tree

3 files changed

+26
-7
lines changed

3 files changed

+26
-7
lines changed

frontend/src/views/chat/ChatCreator.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { chatApi, ChatInfo } from '@/api/chat.ts'
33
import { onMounted, ref } from 'vue'
44
import { datasourceApi } from '@/api/datasource.ts'
55
import DatasourceItemCard from '../ds/DatasourceItemCard.vue'
6+
import { useRoute } from 'vue-router'
67
78
const dsList = ref<Array<any>>([])
89
@@ -13,6 +14,7 @@ function listDs() {
1314
dsList.value = res
1415
})
1516
}
17+
const route = useRoute()
1618
1719
const dialogVisible = ref(false)
1820
@@ -66,6 +68,9 @@ function createChat(datasource: number) {
6668
6769
onMounted(() => {
6870
listDs()
71+
const id = route.query.id as unknown as number
72+
if (!id) return
73+
createChat(id)
6974
})
7075
7176
defineExpose({

frontend/src/views/ds/Card.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,21 @@ const props = withDefaults(
1212
defineProps<{
1313
name: string
1414
type: string
15+
type_name: string
1516
rate?: string
1617
description?: string
1718
id?: string
1819
}>(),
1920
{
2021
name: '-',
2122
type: '-',
22-
rate: '-',
2323
description: '-',
2424
id: '-',
25+
type_name: '-',
2526
}
2627
)
2728
28-
const emits = defineEmits(['edit', 'del', 'question', 'dataTableDetail'])
29+
const emits = defineEmits(['edit', 'del', 'question', 'dataTableDetail', 'showTable'])
2930
const icon = computed(() => {
3031
return (dsTypeWithImg.find((ele) => props.type === ele.type) || {}).img
3132
})
@@ -57,7 +58,7 @@ const onClickOutside = () => {
5758
<img :src="icon" width="32px" height="32px" />
5859
<div class="info">
5960
<div class="name">{{ name }}</div>
60-
<div class="type">{{ type }}</div>
61+
<div class="type">{{ type_name }}</div>
6162
</div>
6263
</div>
6364
<div class="type-value">
@@ -69,7 +70,6 @@ const onClickOutside = () => {
6970
<el-icon class="form-icon" size="16">
7071
<icon_form_outlined></icon_form_outlined>
7172
</el-icon>
72-
{{ rate }}
7373
</div>
7474
<div click.stop class="methods">
7575
<el-button type="primary" style="margin-right: 8px" @click.stop="handleQuestion">

frontend/src/views/ds/Datasource.vue

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import icon_searchOutline_outlined from '@/assets/svg/icon_search-outline_outlin
55
import arrow_down from '@/assets/svg/arrow-down.svg'
66
import icon_add_outlined from '@/assets/svg/icon_add_outlined.svg'
77
import EmptyBackground from '@/views/dashboard/common/EmptyBackground.vue'
8+
import { useRouter } from 'vue-router'
89
import DataTable from './DataTable.vue'
910
import icon_done_outlined from '@/assets/svg/icon_done_outlined.svg'
1011
import icon_close_outlined from '@/assets/svg/operate/ope-close.svg'
@@ -18,12 +19,14 @@ import { useI18n } from 'vue-i18n'
1819
1920
interface Datasource {
2021
name: string
22+
type_name: string
2123
type: string
2224
img: string
23-
rate?: string
25+
description: string
2426
id?: string
2527
}
2628
29+
const router = useRouter()
2730
const { t } = useI18n()
2831
const keywords = ref('')
2932
const defaultDatasourceKeywords = ref('')
@@ -75,6 +78,15 @@ const handleEditDatasource = (res: any) => {
7578
})
7679
}
7780
81+
const handleQuestion = (id: string) => {
82+
router.push({
83+
path: '/chat/index',
84+
query: {
85+
id,
86+
},
87+
})
88+
}
89+
7890
const handleAddDatasource = () => {
7991
editDatasource.value = false
8092
datasourceConfigvVisible.value = true
@@ -208,7 +220,7 @@ const dataTableDetail = (ele: any) => {
208220
</el-icon>
209221
</div>
210222
<div v-if="!defaultDatasourceListWithSearch.length" class="popover-item empty">
211-
没有找到相关结果
223+
{{ t('model.relevant_results_found') }}
212224
</div>
213225
</div>
214226
</div>
@@ -235,7 +247,9 @@ const dataTableDetail = (ele: any) => {
235247
:key="ele.id"
236248
:name="ele.name"
237249
:type="ele.type"
238-
:rate="ele.rate"
250+
:type_name="ele.type_name"
251+
:description="ele.description"
252+
@question="handleQuestion"
239253
@edit="handleEditDatasource(ele)"
240254
@del="deleteHandler(ele)"
241255
@data-table-detail="dataTableDetail(ele)"

0 commit comments

Comments
 (0)