diff --git a/src/api/apiType.ts b/src/api/apiType.ts index 06e5773811ed8338412eb5de46361c95954bf868..f9fd5a1f4814fc7a99c484ce314edf452b4d34fd 100644 --- a/src/api/apiType.ts +++ b/src/api/apiType.ts @@ -1,21 +1,21 @@ export interface CreateKbRequest { - default_chunk_size: number; - default_parser_method: string; + defaultChunkSize: number; + defaultParseMethod: string; description: string; - document_type_list: string[]; - embedding_model: string; - name: string; + docTypes: string[]; + embeddingModel: string; + kbName: string; [property: string]: any; } export interface UpdateKbRequest { - default_chunk_size: number; - default_parser_method: string; + defaultChunkSize: number; + defaultParseMethod: string; description: string; - document_type_list: object[]; - embedding_model: string; - id: string; - name: string; + docTypes: object[]; + embeddingModel: string; + teamId?: string; + kbName: string; [property: string]: any; } diff --git a/src/api/kbApp.ts b/src/api/kbApp.ts index 2a2822f8dd7d959baf90ec9c59ba77d88ba5367c..2d7dc6ae94db668a3ade76449b7465a6399002b3 100644 --- a/src/api/kbApp.ts +++ b/src/api/kbApp.ts @@ -6,7 +6,7 @@ class KbAppAPI { /** 获取用户所有知识库*/ static getKbLibrary(data: QueryKbRequest) { return request({ - url: `/kb/list`, + url: `/kb/team`, method: 'post', data: data, }); @@ -22,20 +22,22 @@ class KbAppAPI { } /** 创建用户知识库*/ - static createKbLibrary(data: CreateKbRequest) { + static createKbLibrary(params: { teamId: string }, data: CreateKbRequest) { return request({ - url: `/kb/create`, + url: `/kb`, method: 'post', data: data, + params, }); } /**更新资产库 */ - static updateKbLibrary(data: UpdateKbRequest) { + static updateKbLibrary(params: { teamId: string }, data: UpdateKbRequest) { return request({ - url: `/kb/update`, - method: 'post', + url: `/kb`, + method: 'put', data: data, + params, }); } @@ -105,14 +107,14 @@ class KbAppAPI { static queryLanguageList() { return request({ - url: `/kb/language`, + url: `/other/tokenizer`, method: 'get', }); } static queryEmbeddingModelList() { return request({ - url: `/other/embedding_model`, + url: `/other/embedding`, method: 'get', }); } diff --git a/src/components/KnowledgeForm/index.vue b/src/components/KnowledgeForm/index.vue index 4ea936e14ff83969357bbccaf6b7a5f1aa311838..655948af177c6c7b8ba20c16c668836092588537 100644 --- a/src/components/KnowledgeForm/index.vue +++ b/src/components/KnowledgeForm/index.vue @@ -29,9 +29,9 @@ + prop="kbName"> @@ -49,9 +49,9 @@ + prop="tokenizer"> + prop="embeddingModel"> {{ $t('assetLibrary.embeddedModel') }} + prop="defaultParseMethod"> @@ -110,7 +110,7 @@ + prop="defaultChunkSize"> {{ $t('assetLibrary.fileChunkSize') }} 128~1024) + prop="uploadCountLimit"> {{ $t('assetLibrary.numberUpperLimit') }} (128~1024) + prop="uploadSizeLimit"> {{ $t('assetLibrary.sizeUpperLimit') }} (128M~2048M) @@ -181,7 +181,7 @@ class="config-form"> {{ $t('btnText.add') }} @@ -196,12 +196,12 @@ (); const createLoading = ref(false); const isSubmitDisabled = ref(true); const ruleForm = ref({ - name: '', - language: '', - default_chunk_size: 1024, - embedding_model: '', - default_parser_method: '', - document_type_list: [], + kbName: '', + tokenizer: '', + defaultChunkSize: 512, + embeddingModel: '', + defaultParseMethod: '', + docTypes: [], description: '', + uploadSizeLimit: 512, + uploadCountLimit: 128, }); const languageOptions = ref(); const emBeddingModelOptions = ref(); @@ -308,20 +312,19 @@ onMounted(() => { ? JSON.parse( JSON.stringify({ ...props.formData, - document_type_list: props.formData?.document_type_list.filter( + docTypes: props.formData?.docTypes.filter( (item: any) => item?.type?.length ), - default_chunk_size: props.formData.default_chunk_size || 1024, + defaultChunkSize: props.formData.defaultChunkSize || 512, + uploadSizeLimit: props.formData?.uploadSizeLimit || 512, + uploadCountLimit: props.formData?.uploadCountLimit || 128, } as RuleForm) ) : ruleForm.value; KbAppAPI.queryLanguageList().then((res: any) => { languageOptions.value = res?.map((item: any) => { - if (item === 'English') { - return { label: item, value: 'en' }; - } - return { label: item, value: 'zh' }; + return { label: item, value: item }; }); }); @@ -362,7 +365,7 @@ const rules = reactive>({ required: true, }, ], - name: [ + kbName: [ { required: true, message: t('assetLibrary.message.name'), @@ -374,34 +377,36 @@ const rules = reactive>({ trigger: ['blur', 'change'], }, ], - language: [ + tokenizer: [ { required: true, message: t('assetLibrary.message.languagePlace'), - trigger: ['blur', 'chanblurge'], + trigger: ['blur', 'change'], }, ], - embedding_model: [ + embeddingModel: [ { required: true, message: t('assetLibrary.message.modelPlace'), trigger: ['blur', 'change'], }, ], - default_parser_method: [ + defaultParseMethod: [ { required: true, message: t('assetLibrary.message.analyticMethodPlace'), trigger: ['blur', 'change'], }, ], - default_chunk_size: [ + defaultChunkSize: [ { message: t('assetLibrary.message.pleasePlace'), trigger: ['blur', 'change'], required: true, }, ], + uploadSizeLimit:[ { required: true } ], + uploadCountLimit:[ { required: true } ], }); const handleCopyTextToclipboard = (text: string) => { @@ -434,22 +439,23 @@ const submitForm = async (formEl: FormInstance | undefined) => { if (!formEl) return; await formEl.validate((valid) => { let payload = { - name: ruleForm.value.name, - language: ruleForm.value?.language?.toLocaleLowerCase(), + kbName: ruleForm.value.kbName, + tokenizer: ruleForm.value?.tokenizer?.toLocaleLowerCase(), description: ruleForm.value.description, - embedding_model: ruleForm.value.embedding_model, - default_parser_method: ruleForm.value.default_parser_method, - default_chunk_size: ruleForm.value.default_chunk_size, - document_type_list: ruleForm.value.document_type_list.filter((item) => item.type.length > 0), + embeddingModel: ruleForm.value.embeddingModel, + defaultParseMethod: ruleForm.value.defaultParseMethod, + defaultChunkSize: ruleForm.value.defaultChunkSize, + uploadCountLimit: ruleForm.value.uploadCountLimit, + uploadSizeLimit: ruleForm.value.uploadSizeLimit, + docTypes: ruleForm.value.docTypes.filter((item) => item.type.length > 0), }; if (valid) { loading.visible.value = true; createLoading.value = true; if (ruleForm.value?.id) { KbAppAPI.updateKbLibrary({ - id: ruleForm.value.id, - ...payload, - }) + teamId: ruleForm.value.id, + },payload) .then((res) => { props.handleOpsKbForm(); if (props.configInfo) { @@ -462,16 +468,16 @@ const submitForm = async (formEl: FormInstance | undefined) => { customClass: 'o-message--success', duration: 3000, }); - ruleForm.value.document_type_list = (res as any).document_type_list; + ruleForm.value.docTypes = (res as any).docTypes; }) .finally(() => { loading.visible.value = false; createLoading.value = false; }); } else { - KbAppAPI.createKbLibrary({ + KbAppAPI.createKbLibrary({teamId:ruleForm.value.teamId},{ ...payload, - document_type_list: ruleForm.value.document_type_list.map((item) => item.type), + docTypes: ruleForm.value.docTypes.map((item) => item.type), }) .then(() => { props.handleOpsKbForm(); @@ -493,15 +499,15 @@ const handleCancelForm = () => { }; const handleRemoveDocType = (index: number) => { - ruleForm.value.document_type_list.splice(index, 1); + ruleForm.value.docTypes.splice(index, 1); }; const handleRemoveAllDocType = () => { - ruleForm.value.document_type_list.splice(0); + ruleForm.value.docTypes.splice(0); }; const handleAddDocType = () => { - ruleForm.value.document_type_list.push({ + ruleForm.value.docTypes.push({ id: uuidv4(), type: '', }); diff --git a/src/plugins/index.ts b/src/plugins/index.ts index e5f9bc0bf8f39f7a77e38e1dcbd0223d513f2075..75cad3f06cdd299b59f479f39dc6d596c1c2a13f 100644 --- a/src/plugins/index.ts +++ b/src/plugins/index.ts @@ -13,8 +13,6 @@ export default { setupI18n(app); // Element-plus图标 setupElIcons(app); - // 路由守卫 - setupPermission(); // 状态管理(store) setupStore(app); }, diff --git a/src/router/index.ts b/src/router/index.ts index 8df835ece8e9be993ca36bab645de2b9ae64cb4f..f44a70bb3912a38824050e010f5fc3ccc5adc598 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -6,7 +6,7 @@ export const constantRoutes: RouteRecordRaw[] = [ { path: '/', name: '/', - redirect: '/login', + redirect: '/group', }, { path: '/login', diff --git a/src/store/modules/group.ts b/src/store/modules/group.ts index dae09867b37946215c52ae82b451cf3da024c0da..c18b020e6070764dc0b41c2e0a4da9421290f387 100644 --- a/src/store/modules/group.ts +++ b/src/store/modules/group.ts @@ -1,11 +1,28 @@ import { store } from '@/store'; +interface TeamList { + teamId: string; + teamName: string; + description: string; + authorName: string; + memberCount: string; + isPublic: boolean; +} + export const useGroupStore = defineStore( 'group', () => { let navGroup = ref([{ name: '数据治理', path: '/group', query: {} }]); let groupMenu = ref('knowledge'); let knowledgeTabActive = ref('document'); + let curTeamInfo: Ref = ref({ + teamId: '', + teamName: '', + description: '', + authorName: '', + memberCount: '', + isPublic: false, + }); let handleSwitchMenu = (menu: string) => { groupMenu.value = menu; @@ -16,13 +33,18 @@ export const useGroupStore = defineStore( let handleKnowledgeTab = (key: string) => { knowledgeTabActive.value = key; }; + let setCurTeamInfo = (value: any) => { + curTeamInfo.value = value; + }; return { navGroup, groupMenu, knowledgeTabActive, + curTeamInfo, handleSwitchMenu, delNav, handleKnowledgeTab, + setCurTeamInfo, }; }, { diff --git a/src/styles/group.scss b/src/styles/group.scss index d0cf14e2119c4d311976c003509d157d8c724d26..a5ccee27bd26072ccfcd265365ce96d84557b737 100644 --- a/src/styles/group.scss +++ b/src/styles/group.scss @@ -1,7 +1,7 @@ .group-container { width: 100%; - height: calc(100vh - 300px); - padding: 0 24px 24px; + height: calc(100vh - 304px); + padding: 0 24px; background: rgb(239 239 239); min-width: 820px; @@ -10,8 +10,7 @@ display: flex; flex-direction: column; width: 100%; - height: calc(100vh - 319px); - padding-bottom: 24px; + height: calc(100vh - 304px); overflow-y: auto; background: rgb(253 254 255); border-radius: 4px; @@ -87,7 +86,8 @@ } } .group-content-container{ - min-height: calc(100vh - 470px); + min-height: calc(100vh - 454px); + margin-top: 16px; .group-tabs-content { margin-top: 16px; @@ -96,7 +96,8 @@ display: grid; grid-template-columns: repeat(auto-fill, 339px); gap: 16px; - + max-height: 690px; + overflow-y: auto; .group-card-item { width: 339px; @@ -141,11 +142,13 @@ font-size: 12px; line-height: 16px; color: rgb(78, 88, 101); - margin: 4px 0 16px; + margin: 6px 0 14px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; + cursor: pointer; + } .group-card-footer { @@ -169,7 +172,7 @@ } } .group-table-box { - padding: 16px 0 24px; + padding: 0 0 24px; height: 100%; display: flex; flex-direction: column; @@ -201,6 +204,11 @@ background-color: #f4f6fa; } } + + .el-table__body-wrapper{ + max-height: 660px; + overflow-y: auto + } .group-name-row { color: #0077ff; @@ -270,6 +278,9 @@ } } } + .el-tabs__content{ + padding: 16px 24px 0 !important; + } } } } \ No newline at end of file diff --git a/src/views/dataSet/index.vue b/src/views/dataSet/index.vue index 145bb50ab34dd8eb1e27ed54723ac93766f98e4a..d02fdea715e817401ea2fd0a68a839e4f4ae9ff7 100644 --- a/src/views/dataSet/index.vue +++ b/src/views/dataSet/index.vue @@ -400,6 +400,15 @@ const pagination = ref({ layout: 'total,sizes,prev,pager,next,jumper', }); const searchPayload = ref({ + name: '', + docTypes: [], + chunk_size_order: '', + created_time_order: '', + status: [], + created_time_start: '', + created_time_end: '', + enabled: '', + parser_method: [], isDataCleared: [], }); const { handleKnowledgeTab } = store; diff --git a/src/views/evaluate/index.vue b/src/views/evaluate/index.vue index 5761912f6260f9c3f9417c94559a801620f653fc..5ce1a17d7427e19bbb50099b16384c90cda46e06 100644 --- a/src/views/evaluate/index.vue +++ b/src/views/evaluate/index.vue @@ -1,4 +1,5 @@ + @@ -21,21 +22,20 @@ - - {{ $t('btnText.batchDelete') }} + + 批量下载 - - {{ $t('btnText.batchExport') }} + + {{ $t('btnText.batchDelete') }} - @@ -160,20 +160,20 @@ 暂停 + @click="handleRunTesting(false, scope.row)">暂停 重启 + @click="handleRunTesting(true, scope.row)">重启 下载 删除 + @click="handleDelete([scope.row])">删除 + @size-change="handleSizeChange" @current-change="handleCurrentChange" @change="handleChangePage" /> @@ -187,8 +187,11 @@ import { IconCaretDown, IconCaretUp, IconFilter, IconSearch } from "@computing/o import testData from "./testData.vue"; import { storeToRefs } from "pinia"; import FilterContainr from "@/components/TableFilter/index.vue"; +import EvaluateAPI from "@/api/evaluate"; +import CustomLoading from '@/components/CustomLoading/index.vue'; +import { debounce } from "lodash"; -let testList = [ +let testList = ref([ { datasetId: 1, dataName: 'CVPR-2023', @@ -281,16 +284,17 @@ let testList = [ }, ], }, -]; +]); const store = useGroupStore(); -const { } = storeToRefs(store); +const { knowledgeTabActive } = storeToRefs(store); const { handleKnowledgeTab } = store; const batchDownBth = ref(false); const inputValue = ref(''); const testingTableRef = ref(); const selectedRow = ref([]); +const loading = ref(false); const currentPage = ref(1); -const totalCount = ref(testList.length); +const totalCount = ref(testList.value.length); const currentPageSize = ref(20); const pagination = ref({ pageSizes: [10, 20, 30, 40, 50], @@ -305,6 +309,15 @@ const modelRef = ref(); const statusRef = ref(); const creatorRef = ref(); const modelList = ref([]); +let searchParam = ref({ + datasetId: "6586f21b", + testingId: "", + testingName: "", + llmId: "", + runStatus: "", + scoresOrder: "asc", + authorName: "", +}) const statusList = [ { value: StatusEnum.SUCCESS, @@ -339,7 +352,15 @@ const handleBatchDownBth = (e: boolean) => { batchDownBth.value = e; }; -const handleSearch = () => { }; +const handleInput = debounce(() => { + currentPage.value = 1; + let param = { + ...searchParam.value, + page: currentPage.value, + pageSize: currentPageSize.value + }; + queryTestList(param); +}, 200); const handleCreate = () => { handleKnowledgeTab('dataset'); @@ -361,31 +382,87 @@ const handleSelectRow = (selection: any[], row: any) => { } const handleChangePage = (pageNum: number, pageSize: number) => { + console.log(pageNum, pageSize) currentPage.value = pageNum; currentPageSize.value = pageSize; + let param = { + ...searchParam.value, + page: pageNum, + pageSize: pageSize, + }; + + queryTestList(param); }; const handleTestData = (row: any) => { testDataVisible.value = true; testRowData.value = row; - console.log(row); -} -const handleStop = (row: any) => { - console.log(row); } -const handleRestart = (row: any) => { - console.log(row); +const handleRunTesting = (isRun: boolean, row: any) => { + let param = { + testingId: row.testingId, + run: isRun, + } + EvaluateAPI.runTesting(param).then((res) => { + + }) } const handleDownload = (row: any) => { - console.log(row); + const url = `${window.origin}/witchaind/api/testing/download?testingId=${row.testingId}`; + const a = document.createElement('a'); + a.href = url; + a.download = 'filename'; // 指定文件名 + a.style.display = 'none'; + document.body.appendChild(a); + a.click(); + document.body.removeChild(a); +} +const handleBatchDownload = () => { + selectedRow.value.forEach((item: any) => { + setTimeout(()=>{ + handleDownload(item) + },300) + }) } -const handleDelete = (row: any) => { - console.log(row); +const handleDelete = (arr: any) => { + console.log(arr); + let idList = arr.map((item: any) => { + return item.testingId + }) + EvaluateAPI.deleteTesting(idList).then((res) => { + console.log(res); + }) +} + +const handleBatchDelete = () => { + handleDelete(selectedRow.value) } const handelStatusFilterProper = (filterList: any) => { console.log(filterList); }; const closeFn = () => { - testDataVisible.value = false; + testDataVisible.value = false; } + +const queryTestList = (params: any) => { + loading.value = true; + EvaluateAPI.testingList(params).then((res: any) => { + console.log(res); + testList.value = res.testings; + }).finally(() => { + loading.value = false; + }) +} +watch(knowledgeTabActive, () => { + if (knowledgeTabActive.value === 'evaluation') { + console.log(knowledgeTabActive.value); + let param = { + ...searchParam.value, + testingName: inputValue.value, + page: currentPage.value, + pageSize: currentPageSize.value + }; + queryTestList(param); + } +}) diff --git a/src/views/group/createGroup.vue b/src/views/group/createGroup.vue index 9010007a0f68268b850569949eaf91e2243b4356..d0ca85b15437b1bf3cd5a39fd89063db0766d6b5 100644 --- a/src/views/group/createGroup.vue +++ b/src/views/group/createGroup.vue @@ -4,7 +4,7 @@ @close="handleCancelVisible"> - +