diff --git a/ui/src/api/dataset.ts b/ui/src/api/dataset.ts index dd4360545..f22186383 100644 --- a/ui/src/api/dataset.ts +++ b/ui/src/api/dataset.ts @@ -69,8 +69,28 @@ const delDateset: (dataset_id: String, loading?: Ref) => Promise Promise> = (data) => { - return post(`${prefix}`, data) +const postDateset: (data: datasetData, loading?: Ref) => Promise> = ( + data, + loading +) => { + return post(`${prefix}`, data, undefined, loading) +} + +/** + * 创建Web知识库 + * @param 参数 + * { + "name": "string", + "desc": "string", + "url": "string", + "selector": "string", +} + */ +const postWebDateset: (data: any, loading?: Ref) => Promise> = ( + data, + loading +) => { + return post(`${prefix}`, data, undefined, loading) } /** @@ -132,5 +152,6 @@ export default { getDatesetDetail, putDateset, listUsableApplication, - getDatasetHitTest + getDatasetHitTest, + postWebDateset } diff --git a/ui/src/api/type/dataset.ts b/ui/src/api/type/dataset.ts index 2cd02587b..6ec73c323 100644 --- a/ui/src/api/type/dataset.ts +++ b/ui/src/api/type/dataset.ts @@ -2,6 +2,7 @@ interface datasetData { name: String desc: String documents?: Array + type?: String } export type { datasetData } diff --git a/ui/src/stores/modules/dataset.ts b/ui/src/stores/modules/dataset.ts index ca4219b86..5ef36d82c 100644 --- a/ui/src/stores/modules/dataset.ts +++ b/ui/src/stores/modules/dataset.ts @@ -6,6 +6,7 @@ import { type Ref } from 'vue' export interface datasetStateTypes { baseInfo: datasetData | null + webInfo: any documentsFiles: UploadUserFile[] } @@ -13,12 +14,16 @@ const useDatasetStore = defineStore({ id: 'dataset', state: (): datasetStateTypes => ({ baseInfo: null, + webInfo: null, documentsFiles: [] }), actions: { saveBaseInfo(info: datasetData | null) { this.baseInfo = info }, + saveWebInfo(info: any) { + this.webInfo = info + }, saveDocumentsFile(file: UploadUserFile[]) { this.documentsFiles = file }, diff --git a/ui/src/styles/app.scss b/ui/src/styles/app.scss index 044257b0d..3ccb1e846 100644 --- a/ui/src/styles/app.scss +++ b/ui/src/styles/app.scss @@ -398,6 +398,9 @@ h4 { .primary { color: var(--el-color-primary); } +.info { + color: var(--el-color-info); +} .dotting { display: inline-block; @@ -454,3 +457,28 @@ h4 { padding: 8px 16px 8px 12px; } } + +.card__radio { + width: 100%; + display: block; + + .el-radio { + white-space: break-spaces; + width: 100%; + height: 100%; + line-height: 22px; + color: var(--app-text-color); + } + + :deep(.el-radio__label) { + padding-left: 30px; + width: 100%; + } + :deep(.el-radio__input) { + position: absolute; + top: 16px; + } + .active { + border: 1px solid var(--el-color-primary); + } +} diff --git a/ui/src/utils/utils.ts b/ui/src/utils/utils.ts index dd09e7699..223ecb81d 100644 --- a/ui/src/utils/utils.ts +++ b/ui/src/utils/utils.ts @@ -56,3 +56,11 @@ export function arraySort(list: Array, property: any, desc?: boolean) { return desc ? b[property] - a[property] : a[property] - b[property] }) } + +// 判断对象里所有属性全部为空 +export function isAllPropertiesEmpty(obj: object) { + return Object.values(obj).every( + (value) => + value === null || typeof value === 'undefined' || (typeof value === 'string' && !value) + ) +} diff --git a/ui/src/views/dataset/CreateDataset.vue b/ui/src/views/dataset/CreateDataset.vue index f8582bd48..92dd80d3e 100644 --- a/ui/src/views/dataset/CreateDataset.vue +++ b/ui/src/views/dataset/CreateDataset.vue @@ -3,7 +3,7 @@ -