mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-08 09:17:06 +08:00
feat(chat): Open Question Number
This commit is contained in:
@@ -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<Array<any>>([])
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -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 = () => {
|
||||
<img :src="icon" width="32px" height="32px" />
|
||||
<div class="info">
|
||||
<div class="name">{{ name }}</div>
|
||||
<div class="type">{{ type }}</div>
|
||||
<div class="type">{{ type_name }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="type-value">
|
||||
@@ -69,7 +70,6 @@ const onClickOutside = () => {
|
||||
<el-icon class="form-icon" size="16">
|
||||
<icon_form_outlined></icon_form_outlined>
|
||||
</el-icon>
|
||||
{{ rate }}
|
||||
</div>
|
||||
<div click.stop class="methods">
|
||||
<el-button type="primary" style="margin-right: 8px" @click.stop="handleQuestion">
|
||||
|
||||
@@ -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) => {
|
||||
</el-icon>
|
||||
</div>
|
||||
<div v-if="!defaultDatasourceListWithSearch.length" class="popover-item empty">
|
||||
没有找到相关结果
|
||||
{{ t('model.relevant_results_found') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -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)"
|
||||
|
||||
Reference in New Issue
Block a user