diff --git a/ui/src/api/dataset.ts b/ui/src/api/dataset.ts index 895782feb..60b0b46fc 100644 --- a/ui/src/api/dataset.ts +++ b/ui/src/api/dataset.ts @@ -97,8 +97,11 @@ const postWebDateset: (data: any, loading?: Ref) => Promise * 知识库详情 * @param 参数 dataset_id */ -const getDatesetDetail: (dataset_id: string) => Promise> = (dataset_id) => { - return get(`${prefix}/${dataset_id}`) +const getDatesetDetail: (dataset_id: string, loading?: Ref) => Promise> = ( + dataset_id, + loading +) => { + return get(`${prefix}/${dataset_id}`, undefined, loading) } /** @@ -144,6 +147,19 @@ const getDatasetHitTest: ( return get(`${prefix}/${dataset_id}/hit_test`, data, loading) } +/** + * 同步知识库 + * @param 参数 dataset_id + * @query 参数 sync_type // 同步类型->replace:替换同步,complete:完整同步 + */ +const getSyncWebDateset: ( + dataset_id: string, + sync_type: string, + loading?: Ref +) => Promise> = (dataset_id, sync_type, loading) => { + return get(`${prefix}/${dataset_id}`, { sync_type }, loading) +} + export default { getDateset, getAllDateset, @@ -153,5 +169,6 @@ export default { putDateset, listUsableApplication, getDatasetHitTest, - postWebDateset + postWebDateset, + getSyncWebDateset } diff --git a/ui/src/router/modules/dataset.ts b/ui/src/router/modules/dataset.ts index 5b6301aee..f74999729 100644 --- a/ui/src/router/modules/dataset.ts +++ b/ui/src/router/modules/dataset.ts @@ -60,7 +60,7 @@ const datasetRouter = { parentPath: '/dataset/:id', parentName: 'DatasetDetail' }, - component: () => import('@/views/document/DatasetSetting.vue') + component: () => import('@/views/dataset/DatasetSetting.vue') } ] }, diff --git a/ui/src/stores/modules/dataset.ts b/ui/src/stores/modules/dataset.ts index 5ef36d82c..5deda6ef5 100644 --- a/ui/src/stores/modules/dataset.ts +++ b/ui/src/stores/modules/dataset.ts @@ -38,6 +38,30 @@ const useDatasetStore = defineStore({ reject(error) }) }) + }, + async asyncGetDatesetDetail(id: string, loading?: Ref) { + return new Promise((resolve, reject) => { + datasetApi + .getDatesetDetail(id, loading) + .then((data) => { + resolve(data) + }) + .catch((error) => { + reject(error) + }) + }) + }, + async asyncSyncDateset(id: string, sync_type: string, loading?: Ref) { + return new Promise((resolve, reject) => { + datasetApi + .getSyncWebDateset(id, sync_type, loading) + .then((data) => { + resolve(data) + }) + .catch((error) => { + reject(error) + }) + }) } } }) diff --git a/ui/src/views/dataset/DatasetSetting.vue b/ui/src/views/dataset/DatasetSetting.vue new file mode 100644 index 000000000..53c06f751 --- /dev/null +++ b/ui/src/views/dataset/DatasetSetting.vue @@ -0,0 +1,150 @@ + + + diff --git a/ui/src/views/dataset/component/SyncWebDialog.vue b/ui/src/views/dataset/component/SyncWebDialog.vue new file mode 100644 index 000000000..674109252 --- /dev/null +++ b/ui/src/views/dataset/component/SyncWebDialog.vue @@ -0,0 +1,88 @@ + + + diff --git a/ui/src/views/dataset/index.vue b/ui/src/views/dataset/index.vue index bfeedb398..23e557f11 100644 --- a/ui/src/views/dataset/index.vue +++ b/ui/src/views/dataset/index.vue @@ -53,7 +53,12 @@ - diff --git a/ui/src/views/document/index.vue b/ui/src/views/document/index.vue index 9d91f952f..540e40a66 100644 --- a/ui/src/views/document/index.vue +++ b/ui/src/views/document/index.vue @@ -3,11 +3,18 @@
- 上传文档 +
+ 上传文档 + 导入文档 + + 批量删除 +
+ @@ -108,17 +144,20 @@ import documentApi from '@/api/document' import { numberFormat } from '@/utils/utils' import { datetimeFormat } from '@/utils/time' import { MsgSuccess, MsgConfirm } from '@/utils/message' +import useStore from '@/stores' const router = useRouter() const route = useRoute() const { params: { id } } = route as any +const { dataset } = useStore() const loading = ref(false) let interval: any const filterText = ref('') const documentData = ref([]) const currentMouseId = ref(null) +const datasetDetail = ref({}) const paginationConfig = reactive({ current_page: 1, @@ -258,7 +297,14 @@ function getList(bool?: boolean) { }) } +function getDetail() { + dataset.asyncGetDatesetDetail(id, loading).then((res: any) => { + datasetDetail.value = res.data + }) +} + onMounted(() => { + getDetail() getList() // 初始化定时任务 initInterval()