diff --git a/Dockerfile b/Dockerfile index feb537c752ff969b620766de247f9f896fc7e74c..0ddb6b8c5a0cc4fb82248894aa2af4207e56eb89 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,6 @@ RUN npm install pnpm -g --registry=https://registry.npmmirror.com && \ pnpm install --registry=https://registry.npmmirror.com && \ pnpm run build - FROM hub.oepkgs.net/openeuler/openeuler:22.03-lts-sp4 ENV TZ Asia/Shanghai diff --git a/deploy/prod/nginx.conf.tmpl b/deploy/prod/nginx.conf.tmpl index d91f5f6723b2913275c040e7a67144ddf0b853d6..f0328230093a3c209a4f072efd2101283330b4e6 100644 --- a/deploy/prod/nginx.conf.tmpl +++ b/deploy/prod/nginx.conf.tmpl @@ -67,10 +67,7 @@ http { add_header Referrer-Policy "no-referrer"; add_header X-Content-Type-Options nosniff; add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data: base64;"; - add_header Cache-Control "no-cache,no-store,must-revalidate"; - add_header Pragma no-cache; - add_header Expires 0; - # limit_conn limitperip 10; + add_header Cache-Control "no-cache"; if ($request_method !~ ^(GET|HEAD|POST|PUT|DELETE)$) { return 444; @@ -102,13 +99,8 @@ http { location /witchaind/api/ { proxy_set_header X-Real-IP $remote_addr; - add_header X-XSS-Protection "1; mode=block"; add_header X-Frame-Options DENY; - add_header X-Content-Type-Options nosniff; - add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data: base64;"; add_header Cache-Control "no-cache,no-store,must-revalidate"; - add_header Pragma no-cache; - add_header Expires 0; proxy_buffering off; error_page 404 = @not_found; diff --git a/package.json b/package.json index d6658fa27c41d901ef4f63bf5333b3a48532aa21..7ccb607a916541c7620776da6c9b64b12c9feead 100644 --- a/package.json +++ b/package.json @@ -113,7 +113,6 @@ "stylelint-config-recommended-scss": "^14.1.0", "stylelint-config-recommended-vue": "^1.5.0", "stylelint-config-standard": "^36.0.1", - "terser": "^5.31.6", "typescript": "^5.5.4", "unocss": "^0.58.9", "unplugin-auto-import": "^0.17.8", diff --git a/src/App.vue b/src/App.vue index 830a0fc9c9c16bebe260b41193c1245849b1ae1c..69cf440a1d04c3f6ab845bab56722869ee750259 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,18 +1,62 @@ - + \ No newline at end of file diff --git a/src/api/apiType.ts b/src/api/apiType.ts index f9fd5a1f4814fc7a99c484ce314edf452b4d34fd..6e311575d347cb6c372c2f488835bfd1e719c0d8 100644 --- a/src/api/apiType.ts +++ b/src/api/apiType.ts @@ -2,7 +2,7 @@ export interface CreateKbRequest { defaultChunkSize: number; defaultParseMethod: string; description: string; - docTypes: string[]; + docTypes: any[]; embeddingModel: string; kbName: string; [property: string]: any; @@ -32,10 +32,10 @@ export interface DocListRequest { chunk_size_order?: string; created_time_order?: string; document_type?: string; - kb_id: string; + kbId: string; name?: string; - page_number: number; - page_size: number; + page: number; + pageSize: number; parse_status?: string; [property: string]: any; } diff --git a/src/api/kbApp.ts b/src/api/kbApp.ts index 2d7dc6ae94db668a3ade76449b7465a6399002b3..137e6ea5a98db5f697baaaa7d2dae0b344745df4 100644 --- a/src/api/kbApp.ts +++ b/src/api/kbApp.ts @@ -1,7 +1,16 @@ import request from '@/utils/request'; import { CreateKbRequest, QueryKbRequest, UpdateKbRequest } from './apiType'; import { ModelForm } from '@/components/UserHeaderBar/modelConfig'; - +import qs from 'qs'; + +type ITaskType = + | 'doc_parse' + | 'kb_export' + | 'kb_import' + | 'dataset_export' + | 'dataset_import' + | 'dataset_generate' + | 'tetsing_run'; class KbAppAPI { /** 获取用户所有知识库*/ static getKbLibrary(data: QueryKbRequest) { @@ -13,11 +22,12 @@ class KbAppAPI { } /** 删除用户知识库*/ - static delKbLibrary(data: { id: string; task_id: string }) { + static delKbLibrary(data: { kbIds: string[] }) { return request({ - url: `/kb/rm`, - method: 'post', - data: data, + url: `/kb`, + method: 'delete', + params: data, + paramsSerializer: (params) => qs.stringify(params, { indices: false }), }); } @@ -32,7 +42,7 @@ class KbAppAPI { } /**更新资产库 */ - static updateKbLibrary(params: { teamId: string }, data: UpdateKbRequest) { + static updateKbLibrary(params: { kbId: string }, data: UpdateKbRequest) { return request({ url: `/kb`, method: 'put', @@ -41,29 +51,30 @@ class KbAppAPI { }); } - /** 获取导入知识库状态*/ - static queryKbTaskList(data: { types: any[]; page_size: number; page_number: number }) { + /** 获取导入/导出任务状态*/ + static queryTaskList(data: { taskType: ITaskType; pageSize: number; page: number }) { return request({ - url: `/kb/task/list`, + url: `/task`, method: 'post', data: data, }); } - static stopKbTaskList(data: { task_id?: string; types?: any[] }) { + static stopKbTaskList(data: { taskId?: string; taskType?: ITaskType }) { return request({ - url: `/kb/task/rm`, - method: 'post', - data: data, + url: `/task`, + method: 'delete', + params: data, }); } /**导入资产库 */ - static importKbLibrary(payload: { data: any }, options: any) { + static importKbLibrary(payload: { data: any; params: any }, options: any) { return request({ url: `/kb/import`, method: 'post', data: payload.data, + params: payload.params, headers: { 'Content-Type': 'multipart/form-data', }, @@ -78,12 +89,13 @@ class KbAppAPI { /**打包资产库 */ - static savebLibrary(id: string, options: any) { + static savebLibrary(kbIds: string[], options: any) { return request({ url: `/kb/export`, - data: { - id, + params: { + kbIds, }, + paramsSerializer: (params) => qs.stringify(params, { indices: false }), method: 'post', onUploadProgress(e) { const rate = Math.floor((e.loaded / (e.total as number)) * 100); diff --git a/src/api/kfApp.ts b/src/api/kfApp.ts index a2675e08091fc622ff7daf9d7d6312cff96ad747..3097be59bd1caef3edb515062689ba7a2dcfd474 100644 --- a/src/api/kfApp.ts +++ b/src/api/kfApp.ts @@ -49,8 +49,9 @@ class KfAppAPI { /**导入资产库文档 */ static importKbLibraryFile(payload: { data: any; params: any }, options: any) { return request({ - url: `/doc/upload?kb_id=${payload.params.kb_id}`, + url: `/doc`, method: 'post', + params: payload.params, data: payload.data, headers: { 'Content-Type': 'multipart/form-data', diff --git a/src/assets/fonts/HarmonyOS/HarmonyOS_font.css b/src/assets/fonts/HarmonyOS/HarmonyOS_font.css index d078d578a946f8ff78ca00f55eb22f12273f266f..b03886c71bf1435dac35e43aa77b6796e83f9ece 100644 --- a/src/assets/fonts/HarmonyOS/HarmonyOS_font.css +++ b/src/assets/fonts/HarmonyOS/HarmonyOS_font.css @@ -11,24 +11,6 @@ */ /* 鸿蒙中文 */ -@font-face { - font-family: 'HarmonyOS Sans SC Thin'; - src: - url(./HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Thin.woff2) format('woff2'), - url(./HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Thin.woff) format('woff'); - font-weight: 100; - font-style: normal; -} - -@font-face { - font-family: 'HarmonyOS Sans SC Light'; - src: - url(./HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Light.woff2) format('woff2'), - url(./HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Light.woff) format('woff'); - font-weight: 300; - font-style: normal; -} - @font-face { font-family: 'HarmonyOS Sans SC Regular'; src: @@ -37,85 +19,3 @@ font-weight: 400; font-style: normal; } - -@font-face { - font-family: 'HarmonyOS Sans SC Medium'; - src: - url(./HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Medium.woff2) format('woff2'), - url(./HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Medium.woff) format('woff'); - font-weight: 500; - font-style: normal; -} - -@font-face { - font-family: 'HarmonyOS Sans SC Bold'; - src: - url(./HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Bold.woff2) format('woff2'), - url(./HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Bold.woff) format('woff'); - font-weight: 700; - font-style: normal; -} - -@font-face { - font-family: 'HarmonyOS Sans SC Black'; - src: - url(./HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Black.woff2) format('woff2'), - url(./HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Black.woff) format('woff'); - font-weight: 900; - font-style: normal; -} - -/* 鸿蒙西文字体 */ -@font-face { - font-family: 'HarmonyOS Sans En Thin'; - src: - url(./HarmonyOS_Sans/HarmonyOS_Sans_Thin.woff2) format('woff2'), - url(./HarmonyOS_Sans/HarmonyOS_Sans_Thin.woff) format('woff'); - font-weight: 100; - font-style: normal; -} - -@font-face { - font-family: 'HarmonyOS Sans En Light'; - src: - url(./HarmonyOS_Sans/HarmonyOS_Sans_Light.woff2) format('woff2'), - url(./HarmonyOS_Sans/HarmonyOS_Sans_Light.woff) format('woff'); - font-weight: 300; - font-style: normal; -} - -@font-face { - font-family: 'HarmonyOS Sans En Regular'; - src: - url(./HarmonyOS_Sans/HarmonyOS_Sans_Regular.woff2) format('woff2'), - url(./HarmonyOS_Sans/HarmonyOS_Sans_Regular.woff) format('woff'); - font-weight: 400; - font-style: normal; -} - -@font-face { - font-family: 'HarmonyOS Sans En Medium'; - src: - url(./HarmonyOS_Sans/HarmonyOS_Sans_Medium.woff2) format('woff2'), - url(./HarmonyOS_Sans/HarmonyOS_Sans_Medium.woff) format('woff'); - font-weight: 500; - font-style: normal; -} - -@font-face { - font-family: 'HarmonyOS Sans En Bold'; - src: - url(./HarmonyOS_Sans/HarmonyOS_Sans_Bold.woff2) format('woff2'), - url(./HarmonyOS_Sans/HarmonyOS_Sans_Bold.woff) format('woff'); - font-weight: 700; - font-style: normal; -} - -@font-face { - font-family: 'HarmonyOS Sans En Black'; - src: - url(./HarmonyOS_Sans/HarmonyOS_Sans_Black.woff2) format('woff2'), - url(./HarmonyOS_Sans/HarmonyOS_Sans_Black.woff) format('woff'); - font-weight: 900; - font-style: normal; -} diff --git a/src/assets/images/login-background-light.png b/src/assets/images/login-background-light.png deleted file mode 100644 index bbdbc96190782177734971a1c411ef627382cecb..0000000000000000000000000000000000000000 Binary files a/src/assets/images/login-background-light.png and /dev/null differ diff --git a/src/assets/images/login-background-light.webp b/src/assets/images/login-background-light.webp new file mode 100644 index 0000000000000000000000000000000000000000..4a7f7719b05608234e8895d51f1818734a90eb2f Binary files /dev/null and b/src/assets/images/login-background-light.webp differ diff --git a/src/components/KnowledgeForm/index.vue b/src/components/KnowledgeForm/index.vue index 655948af177c6c7b8ba20c16c668836092588537..092479817a06cbc3fec728f9a8e6955e9f3ab1a2 100644 --- a/src/components/KnowledgeForm/index.vue +++ b/src/components/KnowledgeForm/index.vue @@ -243,6 +243,7 @@ import TextTooltip from '@/components/TextSingleTootip/index.vue'; import { v4 as uuidv4 } from 'uuid'; import KbAppAPI from '@/api/kbApp'; +const route = useRoute() const { t } = useI18n(); const loading = ElLoading.service({ visible: false, @@ -434,7 +435,6 @@ onMounted(() => { } }); }); - const submitForm = async (formEl: FormInstance | undefined) => { if (!formEl) return; await formEl.validate((valid) => { @@ -452,9 +452,9 @@ const submitForm = async (formEl: FormInstance | undefined) => { if (valid) { loading.visible.value = true; createLoading.value = true; - if (ruleForm.value?.id) { + if (ruleForm.value?.kbId) { KbAppAPI.updateKbLibrary({ - teamId: ruleForm.value.id, + kbId: ruleForm.value.kbId, },payload) .then((res) => { props.handleOpsKbForm(); @@ -475,9 +475,13 @@ const submitForm = async (formEl: FormInstance | undefined) => { createLoading.value = false; }); } else { - KbAppAPI.createKbLibrary({teamId:ruleForm.value.teamId},{ + let docArr:any = [] + ruleForm.value.docTypes.map((item) => { + docArr.push({doc_type_id:item.id,doc_type_name:item.type}) + } ) + KbAppAPI.createKbLibrary({teamId:route.query.id?.toString() ?? ''},{ ...payload, - docTypes: ruleForm.value.docTypes.map((item) => item.type), + docTypes: docArr }) .then(() => { props.handleOpsKbForm(); diff --git a/src/components/Upload/index.vue b/src/components/Upload/index.vue index d076d3b8a2cd19f81509c19091af293d310ebcae..fe382f9c1cc1aa9dc38ac1fe2153044f0fd1fde5 100644 --- a/src/components/Upload/index.vue +++ b/src/components/Upload/index.vue @@ -30,7 +30,7 @@ props.maxFileNum }} -
+
{{ $t('dialogTipText.fileSizes') }}:{{ allFileSizesInfo }}/{{ maxFileSizesInfo }}
@@ -130,7 +130,7 @@ class="resetBtn" type="primary" :disabled="btnDisabled" - @click="uploadType === 'file' ? uploadKnowledgeFile() : uploadFiles()"> + @click="handleFileType(uploadType)"> {{ $t('btnText.confirm') }} { + switch(type){ + case 'file': + uploadKnowledgeFile(); + break; + case 'dataset': + uploadDatasetFile(); + break; + case 'kbfile': + uploadFiles(); + break; + default: + break; + } +} const doUpload = (options: any) => { props.handleUploadMyFile(options); }; @@ -295,7 +310,7 @@ const handleChange = (file: UploadFile) => { }; // 超出文件数量限制时的处理 -const handleExceed = (files: File[], uploadFiles: any[]) => { +const handleExceed = () => { ElMessage.warning(`超出文件数量限制,最多只能上传 ${props.maxFileNum} 个文件!`); }; @@ -427,20 +442,24 @@ const uploadFiles = () => { } }, onError: (e: any) => { + uploadFileNumber += 1; uploadingList.value = uploadingList.value.map((up) => { if (up.id === e.id) { - return e; + return { ...e, uploadStatus: 'error'}; } return up; }); + props?.handleImportLoading(false); + handleToggleUploadNotify(); }, onSuccess: () => { uploadFileNumber += 1; if (uploadFileNumber === fileTableList.data.length) { props.handleQueryTaskList(); + fileTableList.data = []; } }, - fileInfo: item, + fileInfo: item }); }); uploadingList.value = [ @@ -462,11 +481,10 @@ const uploadFiles = () => { }; }), ]; - uploadingList.value.length && handleToggleUploadNotify(); props.handleCancelVisible(); - fileTableList.data = []; uploadRef.value?.clearFiles(); allFileSizes.value = 0; + uploadingList.value.length && handleToggleUploadNotify(); }); }; @@ -511,6 +529,8 @@ const uploadKnowledgeFile = () => { } return up; }); + props?.handleImportLoading(false); + handleToggleUploadNotify(); // 立即显示错误状态 reject(e); // 传递错误 }, onSuccess: () => { @@ -548,6 +568,72 @@ const uploadKnowledgeFile = () => { allFileSizes.value = 0; }; +// 提交数据集 +const uploadDatasetFile = () => { + props?.handleImportLoading(true); + let uploadFileNumber = 0; + uploadingList.value = fileTableList.data.map((item) => { + return { + id: item.id, + name: item.name, + file: item.file, + percent: 0, + newUploadTask: true, + }; + }); + const uploadPromises = uploadingList.value.map((item) => { + return new Promise((resolve, reject) => { + doUpload({ + file: item.file, + onProgress: (evt: any) => { + if (evt < 100) { + item.percent = evt; + } + }, + onError: (e: any) => { + uploadingList.value = uploadingList.value.map((up) => { + if (up.id === e.id) { + return { ...e, uploadStatus: 'error' }; + } + return up; + }); + reject(e); // 传递错误 + }, + onSuccess: () => { + uploadFileNumber += 1; + item.percent = 100; + item.uploadStatus = 'success'; + resolve(true); // 标记成功 + }, + fileInfo: item, + }); + }); + }); + + // 所有上传完成后统一更新列表 + Promise.allSettled(uploadPromises).then((results) => { + const successCount = results.filter((result) => result.status === 'fulfilled').length; + const errorCount = results.length - successCount; + + // 统一更新列表 + props?.handleImportLoading(false); + if (errorCount > 0) { + handleToggleUploadNotify(); + } + + // 所有成功后的回调 + if (errorCount === 0) { + props.handleQueryTaskList(fileTableList.data); // 统一更新列表 + } + }); + + uploadingList.value.length && handleToggleUploadNotify(); + props.handleCancelVisible(); + fileTableList.data = []; + uploadRef.value?.clearFiles(); + allFileSizes.value = 0; +} + const handleToggleUploadNotify = () => { props.toggleUploadNotify({ showUploadNotify: true, diff --git a/src/components/Upload/uploadProgress.vue b/src/components/Upload/uploadProgress.vue index b660e5130b8df628da1e745a99f9d85062ced9e7..32c89d5400a183a6101873596b2915d4c9abf88c 100644 --- a/src/components/Upload/uploadProgress.vue +++ b/src/components/Upload/uploadProgress.vue @@ -46,7 +46,7 @@ :content="`,${$t('dialogTipText.fileSize')} ${bytesToSize(item?.file?.size || item?.size || 0)}`" />
{{ `,${$t('assetLibrary.uploadIng')}...` }}
@@ -72,7 +72,7 @@ {{ $t('uploadText.uploadSuccess') }}
diff --git a/src/components/UserHeaderBar/headerCom.vue b/src/components/UserHeaderBar/headerCom.vue index e5ea0fcd5b58e3b9dd779df7f68bb236ac9bccd8..567de347dee5faf084d060b2261d1b11ddf7da29 100644 --- a/src/components/UserHeaderBar/headerCom.vue +++ b/src/components/UserHeaderBar/headerCom.vue @@ -309,23 +309,7 @@ const handleClose = () => { }; }; -/** - * 处理接postmessage收到的数据,根据消息中的语言设置应用语言。 - * 该函数会根据接收到的语言代码更新应用的语言设置,并将其存储在本地存储中。 - */ -const handleMessage = (e: MessageEvent) => { - const langObj = { - CN: 'zh', - EN: 'en', - }; - let lang = langObj[e.data.lang as keyof typeof langObj]; - locale.value = lang; - appStore.changeLanguage(lang); - localStorage.setItem('language', lang); -}; - onMounted(() => { - window.addEventListener('message', handleMessage); userInfo.value = JSON.parse(localStorage.getItem('userInfo') || '{}'); userLanguage.value = userInfo.value?.language; if (openai_api_type.value === 'local') { @@ -335,7 +319,6 @@ onMounted(() => { } getModelInfo(); }); -onUnmounted(() => window.removeEventListener('message', handleMessage)); const getModelInfo = () => { KbAppAPI.getdUserModel().then((res: any) => { @@ -602,7 +585,7 @@ const handleModelVisible = (visible: boolean) => { } .el-dialog__title { - font-family: 'HarmonyOS Sans SC Bold', sans-serif !important; + font-family: 'HarmonyOS Sans SC Regular', sans-serif !important; font-weight: 800; } diff --git a/src/store/modules/app.ts b/src/store/modules/app.ts index 0d9548d8f3b23d7b683edf3debf1ff9ee6965f88..1150e16c2116cfa227e4f0eacae561d91b655325 100644 --- a/src/store/modules/app.ts +++ b/src/store/modules/app.ts @@ -6,6 +6,12 @@ import en from 'element-plus/es/locale/lang/en'; import { store } from '@/store'; export const useAppStore = defineStore('app', () => { + const parentToken = ref(''); + + function changeParentToken(value: string) { + parentToken.value = value; + } + // 语言 const language = useStorage('language', defaultSettings.language); /** @@ -31,6 +37,8 @@ export const useAppStore = defineStore('app', () => { language, locale, changeLanguage, + parentToken, + changeParentToken, }; }); diff --git a/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Black.woff b/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Black.woff deleted file mode 100644 index d3a7a9a2f445580353177f71592f722a9f8264b7..0000000000000000000000000000000000000000 Binary files a/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Black.woff and /dev/null differ diff --git a/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Black.woff2 b/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Black.woff2 deleted file mode 100644 index 5b1b8fbe5c2b665c378f29a78c8bf9b245bafbe5..0000000000000000000000000000000000000000 Binary files a/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Black.woff2 and /dev/null differ diff --git a/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Bold.woff b/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Bold.woff deleted file mode 100644 index 90e19c2273855080af70ae1d57f4c650584947b9..0000000000000000000000000000000000000000 Binary files a/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Bold.woff and /dev/null differ diff --git a/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Bold.woff2 b/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Bold.woff2 deleted file mode 100644 index 69d0baa5db0c1fd1a6581c8fec2833e0d681c4ef..0000000000000000000000000000000000000000 Binary files a/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Bold.woff2 and /dev/null differ diff --git a/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Light.woff b/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Light.woff deleted file mode 100644 index e06f7add695edd7ee5c39c1a67527a7df51dfae2..0000000000000000000000000000000000000000 Binary files a/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Light.woff and /dev/null differ diff --git a/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Light.woff2 b/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Light.woff2 deleted file mode 100644 index f3731ae01c816eb7d461837b423d4a2b563e113f..0000000000000000000000000000000000000000 Binary files a/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Light.woff2 and /dev/null differ diff --git a/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Medium.woff b/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Medium.woff deleted file mode 100644 index 0568219cd88f5d376a7f083cf23cdce705cb70c9..0000000000000000000000000000000000000000 Binary files a/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Medium.woff and /dev/null differ diff --git a/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Medium.woff2 b/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Medium.woff2 deleted file mode 100644 index 63f418cb53701cd899c031cb189857d08cb1264b..0000000000000000000000000000000000000000 Binary files a/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Medium.woff2 and /dev/null differ diff --git a/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Regular.woff b/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Regular.woff deleted file mode 100644 index dbe11e9c8547a59da3eae6174b5f2201c321d02f..0000000000000000000000000000000000000000 Binary files a/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Regular.woff and /dev/null differ diff --git a/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Regular.woff2 b/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Regular.woff2 deleted file mode 100644 index 633a70c07aee063d0f301b78cd2bf9d06d42d696..0000000000000000000000000000000000000000 Binary files a/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Regular.woff2 and /dev/null differ diff --git a/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Thin.woff b/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Thin.woff deleted file mode 100644 index eb04aef0fa66e71063b346d79cbc2ae21fc67c71..0000000000000000000000000000000000000000 Binary files a/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Thin.woff and /dev/null differ diff --git a/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Thin.woff2 b/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Thin.woff2 deleted file mode 100644 index bfe90d34d1a0823f78574f486ff6c2608007a747..0000000000000000000000000000000000000000 Binary files a/src/styles/HarmonyOS_Sans/HarmonyOS_Sans_Thin.woff2 and /dev/null differ diff --git a/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Black.woff b/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Black.woff deleted file mode 100644 index 4824510dae9974c2f1eb2d64ad96b62d3c133bde..0000000000000000000000000000000000000000 Binary files a/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Black.woff and /dev/null differ diff --git a/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Black.woff2 b/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Black.woff2 deleted file mode 100644 index 749b12841bf135f3414e8baf4e18afc80e70587b..0000000000000000000000000000000000000000 Binary files a/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Black.woff2 and /dev/null differ diff --git a/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Bold.woff b/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Bold.woff deleted file mode 100644 index ec892a1c1c6e9feda6d3ce5abe13c14bda6173c7..0000000000000000000000000000000000000000 Binary files a/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Bold.woff and /dev/null differ diff --git a/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Bold.woff2 b/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Bold.woff2 deleted file mode 100644 index 6cb17baa452ae6ee4f688adfa72be2d6c03938e7..0000000000000000000000000000000000000000 Binary files a/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Bold.woff2 and /dev/null differ diff --git a/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Light.woff b/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Light.woff deleted file mode 100644 index ed26373b729bcb24a77741f950286bdd314b5730..0000000000000000000000000000000000000000 Binary files a/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Light.woff and /dev/null differ diff --git a/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Light.woff2 b/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Light.woff2 deleted file mode 100644 index 6a59240cbf4e699739dbe85d4e6d0ce3a21c60d7..0000000000000000000000000000000000000000 Binary files a/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Light.woff2 and /dev/null differ diff --git a/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Medium.woff b/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Medium.woff deleted file mode 100644 index 0ba379afc9b8c643898894a6a7a23076d286aaa5..0000000000000000000000000000000000000000 Binary files a/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Medium.woff and /dev/null differ diff --git a/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Medium.woff2 b/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Medium.woff2 deleted file mode 100644 index d44a28aa609934818b770341d831f566b8b86eb6..0000000000000000000000000000000000000000 Binary files a/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Medium.woff2 and /dev/null differ diff --git a/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Thin.woff b/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Thin.woff deleted file mode 100644 index 650c30466f3378e4e324577b1e4712eeb0ccb1a5..0000000000000000000000000000000000000000 Binary files a/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Thin.woff and /dev/null differ diff --git a/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Thin.woff2 b/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Thin.woff2 deleted file mode 100644 index 37cf9b3340aa41594bc305868a47e54085771a6e..0000000000000000000000000000000000000000 Binary files a/src/styles/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Thin.woff2 and /dev/null differ diff --git a/src/styles/app.scss b/src/styles/app.scss index 3079cf0aa52e1287f7007eb09dc27582e5b0aedd..4f3f02b6a5839efafacccd7b0af950097a1a2a3c 100644 --- a/src/styles/app.scss +++ b/src/styles/app.scss @@ -14,7 +14,7 @@ body, width: 100%; min-width: 600px; overflow-y: auto; - background: url('/src/assets/images/login-background-light.png') center/100% 100%; + background: url('/src/assets/images/login-background-light.webp') center/100% 100%; } .main-container { diff --git a/src/styles/dataSet.scss b/src/styles/dataSet.scss index b6fc73bc78aa918d746a353658e37ce297707793..d9ccbc17d2f172b971f168eff94644796a312a9c 100644 --- a/src/styles/dataSet.scss +++ b/src/styles/dataSet.scss @@ -6,6 +6,13 @@ } .dataSet-container { + .dataSet-container-header{ + display: flex; + justify-content: space-between; + .dataSet-container-right{ + width: 356px; + } + } .el-dropdown.is-disabled .el-button { color: var(--o-button-color_disabled) !important; background-color: var(--o-button-bg-color_disabled) !important; @@ -52,6 +59,7 @@ .statusFail, .statusSuccess, + .statusWaitIng, .statusCancel { height: 24px; width: fit-content; @@ -60,7 +68,7 @@ line-height: 24px; color: rgb(255 255 255); text-align: center; - border-radius: 2px; + border-radius: 4px; } .statusFail { @@ -76,9 +84,8 @@ } .statusWaitIng { - display: flex; - align-items: center; - gap: 9px; + background: rgb(250, 192, 84); + } @keyframes rotate-img { diff --git a/src/styles/evaluate.scss b/src/styles/evaluate.scss index 56ae0e970fcd1ed08fc26b0c19a3d435fba13621..6be9f7aebfb06eb9f210c0cd3100168e02c04ed9 100644 --- a/src/styles/evaluate.scss +++ b/src/styles/evaluate.scss @@ -149,7 +149,6 @@ } .statusWaitIng { - background: rgb(250, 192, 84); } @@ -221,7 +220,6 @@ .evaluate-dataSetName{ color: black; } - } } } diff --git a/src/styles/knowledgeFile.scss b/src/styles/knowledgeFile.scss index 3b4cc149e7e12d376f90732016c41cddc85bc747..f2e407071b8a503b1f74bbc58d4599a96ccdf0b0 100644 --- a/src/styles/knowledgeFile.scss +++ b/src/styles/knowledgeFile.scss @@ -79,40 +79,47 @@ .kf-container-table-ops { display: flex; - margin-bottom: 8px; + justify-content: space-between; + .kf-container-table-ops-left{ + display: flex; + margin-bottom: 8px; - .importFileBtn { - padding: 8px 15px; - } + .importFileBtn { + padding: 8px 15px; + } - .dataSetBtn{ - margin-left: unset !important; - } + .dataSetBtn{ + margin-left: unset !important; + } - .dataSetBtn.is-disabled{ - color: var(--o-button-color_disabled) !important; - background: #ebedf3; - } + .dataSetBtn.is-disabled{ + color: var(--o-button-color_disabled) !important; + background: #ebedf3; + } - .is-disabled { - background: #ebedf3; - } + .is-disabled { + background: #ebedf3; + } - .delFileBtn { - padding: 8px 27px; - margin-left: 8px; + .delFileBtn { + padding: 8px 27px; + margin-left: 8px; - span { - min-width: unset !important; + span { + min-width: unset !important; + } } - } - .el-dropdown { - button { - min-width: 96px; - padding: 8px 13.2px; + .el-dropdown { + button { + min-width: 96px; + padding: 8px 13.2px; + } } } + .kf-container-table-ops-right{ + width: 356px; + } } .kf-container-table-box { @@ -282,7 +289,8 @@ .statusAnalysisText { font-size: 12px; - font-family: 'HarmonyOS Sans SC Medium'; + font-family: 'HarmonyOS Sans SC Regular'; + font-weight: 500; margin-left: 2px; color: rgb(0 0 0); } diff --git a/src/styles/knowledgeLibrary.scss b/src/styles/knowledgeLibrary.scss index 8f1ec23cb8386cb34961b20d83829d1651b16c93..2e72c0cd8244857711143c2f0fb977c92cbedf73 100644 --- a/src/styles/knowledgeLibrary.scss +++ b/src/styles/knowledgeLibrary.scss @@ -240,7 +240,9 @@ } .kl-file-num { - font-family: 'HarmonyOS Sans SC Bold'; + font-size: 14px; + font-family: 'HarmonyOS Sans SC Regular'; + font-weight: 700; } } @@ -265,7 +267,8 @@ } .id-label { - font-family: 'HarmonyOS Sans SC Bold'; + font-family: 'HarmonyOS Sans SC Regular'; + font-weight: 700; } } } diff --git a/src/styles/reset.scss b/src/styles/reset.scss index 374396ba7c963bf787f369381c148968ed9c0422..343469a0afca43aa8ffc73ffe3608ec71d5adf6a 100644 --- a/src/styles/reset.scss +++ b/src/styles/reset.scss @@ -1,21 +1,3 @@ -@font-face { - font-family: 'HarmonyOS Sans SC Thin'; - src: - url(./HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Thin.woff2) format('woff2'), - url(./HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Thin.woff) format('woff'); - font-weight: 100; - font-style: normal; -} - -@font-face { - font-family: 'HarmonyOS Sans SC Light'; - src: - url(./HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Light.woff2) format('woff2'), - url(./HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Light.woff) format('woff'); - font-weight: 300; - font-style: normal; -} - @font-face { font-family: 'HarmonyOS Sans SC Regular'; src: @@ -25,88 +7,6 @@ font-style: normal; } -@font-face { - font-family: 'HarmonyOS Sans SC Medium'; - src: - url(./HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Medium.woff2) format('woff2'), - url(./HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Medium.woff) format('woff'); - font-weight: 500; - font-style: normal; -} - -@font-face { - font-family: 'HarmonyOS Sans SC Bold'; - src: - url(./HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Bold.woff2) format('woff2'), - url(./HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Bold.woff) format('woff'); - font-weight: 700; - font-style: normal; -} - -@font-face { - font-family: 'HarmonyOS Sans SC Black'; - src: - url(./HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Black.woff2) format('woff2'), - url(./HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Black.woff) format('woff'); - font-weight: 900; - font-style: normal; -} - -/* 鸿蒙西文字体 */ -@font-face { - font-family: 'HarmonyOS Sans En Thin'; - src: - url(./HarmonyOS_Sans/HarmonyOS_Sans_Thin.woff2) format('woff2'), - url(./HarmonyOS_Sans/HarmonyOS_Sans_Thin.woff) format('woff'); - font-weight: 100; - font-style: normal; -} - -@font-face { - font-family: 'HarmonyOS Sans En Light'; - src: - url(./HarmonyOS_Sans/HarmonyOS_Sans_Light.woff2) format('woff2'), - url(./HarmonyOS_Sans/HarmonyOS_Sans_Light.woff) format('woff'); - font-weight: 300; - font-style: normal; -} - -@font-face { - font-family: 'HarmonyOS Sans En Regular'; - src: - url(./HarmonyOS_Sans/HarmonyOS_Sans_Regular.woff2) format('woff2'), - url(./HarmonyOS_Sans/HarmonyOS_Sans_Regular.woff) format('woff'); - font-weight: 400; - font-style: normal; -} - -@font-face { - font-family: 'HarmonyOS Sans En Medium'; - src: - url(./HarmonyOS_Sans/HarmonyOS_Sans_Medium.woff2) format('woff2'), - url(./HarmonyOS_Sans/HarmonyOS_Sans_Medium.woff) format('woff'); - font-weight: 500; - font-style: normal; -} - -@font-face { - font-family: 'HarmonyOS Sans En Bold'; - src: - url(./HarmonyOS_Sans/HarmonyOS_Sans_Bold.woff2) format('woff2'), - url(./HarmonyOS_Sans/HarmonyOS_Sans_Bold.woff) format('woff'); - font-weight: 700; - font-style: normal; -} - -@font-face { - font-family: 'HarmonyOS Sans En Black'; - src: - url(./HarmonyOS_Sans/HarmonyOS_Sans_Black.woff2) format('woff2'), - url(./HarmonyOS_Sans/HarmonyOS_Sans_Black.woff) format('woff'); - font-weight: 900; - font-style: normal; -} - ::before, ::after { box-sizing: border-box; @@ -133,9 +33,10 @@ body { :root { --el-font-family: - 'HarmonyOS Sans SC Medium', -apple-system, blinkmacsystemfont, 'Segoe UI', roboto, + 'HarmonyOS Sans SC Regular', -apple-system, blinkmacsystemfont, 'Segoe UI', roboto, 'Helvetica Neue', arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji' !important; + font-weight: 500; } html, @@ -145,7 +46,7 @@ button, .is-selected { margin: 0; font-family: - 'HarmonyOS Sans SC Medium', + 'HarmonyOS Sans SC Regular', -apple-system, BlinkMacSystemFont, 'Segoe UI', @@ -158,6 +59,7 @@ button, 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji' !important; + font-weight: 500; line-height: inherit; -moz-osx-font-smoothing: grayscale; -webkit-font-smoothing: antialiased; @@ -445,7 +347,7 @@ div:focus { } .el-select-dropdown__item { - font-family: 'HarmonyOS Sans SC Medium' !important; + font-family: 'HarmonyOS Sans SC Regular' !important; font-size: 12px; font-weight: unset !important; } diff --git a/src/utils/request.ts b/src/utils/request.ts index ca84c17e9a1eba768f785d82f31fe1dadf4dbbe6..ec9146babd186d031265488577f20d6f1b55a537 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -5,6 +5,7 @@ import { TOKEN_KEY } from '@/enums/CacheEnum'; import qs from 'qs'; import i18n from '@/lang/index'; import { IconError } from '@computing/opendesign-icons'; +import { useAppStore } from '@/store/modules/app'; // 创建 axios 实例 const service = axios.create({ @@ -22,10 +23,15 @@ const service = axios.create({ // 请求拦截器 service.interceptors.request.use( (config: InternalAxiosRequestConfig) => { + const appStore = useAppStore(); + const { parentToken } = storeToRefs(appStore); const accessToken = localStorage.getItem(TOKEN_KEY); if (accessToken) { config.headers.Authorization = accessToken; } + if (parentToken.value) { + config.headers['Authorization'] = `Bearer ${parentToken.value}`; + } return config; }, (error: any) => { diff --git a/src/views/dataSet/craeteEvaluate.vue b/src/views/dataSet/craeteEvaluate.vue index 92ada866b901e0ad641cba63afbb57b89a51f704..8a11a7a657051ad6482581851888bc238fdb3dda 100644 --- a/src/views/dataSet/craeteEvaluate.vue +++ b/src/views/dataSet/craeteEvaluate.vue @@ -27,14 +27,24 @@ - - + + + {{ item.label }} + - - + @@ -51,6 +61,8 @@ diff --git a/src/views/dataSet/dataSetDrawer.vue b/src/views/dataSet/dataSetDrawer.vue index cdca6833bbf9d68fe1d36dcfa01a551f16040454..894a05e2a05edeae45902b6a3434b898294eb988 100644 --- a/src/views/dataSet/dataSetDrawer.vue +++ b/src/views/dataSet/dataSetDrawer.vue @@ -54,14 +54,13 @@
- {{ dataSetInfo.dataSetDesc }} + {{ dataSetInfo.description }}
@@ -119,20 +118,21 @@ @@ -203,8 +203,13 @@ const dataSetInfoEditVisible = ref(false); const onEditList = ref([]); const tableData = ref({ data: [ + { + question: '123', + answer: '123', + + } ], - editableKeys: ['question', 'standardAnswer'], + editableKeys: ['question', 'answer'], }); const selectionDataSetList = ref([]); const props = defineProps({ diff --git a/src/views/dataSet/index.vue b/src/views/dataSet/index.vue index d02fdea715e817401ea2fd0a68a839e4f4ae9ff7..f1384531f7026783d9afaa843f52031e93bd2a09 100644 --- a/src/views/dataSet/index.vue +++ b/src/views/dataSet/index.vue @@ -10,15 +10,15 @@
-
-
+
+
- {{ $t('导入数据集') }} - + type="primary" + style="margin-right: 8px" + @click="handleImportDataSet" + class="importFileBtn"> + {{ $t('导入数据集') }} +
-
- - - - - - - - - - - - - - - - + + + + + + + + + + + + + +
@@ -338,12 +340,41 @@ :dataSetDrawerVisible="dataSetDrawerVisible" :dataSetRow="dataSetRow" :handleDataSetProps="handleDataSetProps" /> + + + + diff --git a/src/views/evaluate/index.vue b/src/views/evaluate/index.vue index 5ce1a17d7427e19bbb50099b16384c90cda46e06..51eb8501feb4254939c5afd684cd8e20d794d813 100644 --- a/src/views/evaluate/index.vue +++ b/src/views/evaluate/index.vue @@ -38,13 +38,13 @@ margin-bottom: 20px" row-key="datasetId" bordered default-expand-all @selection-change="handleSelectionChange" @select="handleSelectRow" @sort-change="handleSortChange"> - - + + - + + - + - + + diff --git a/src/views/evaluate/testData.vue b/src/views/evaluate/testCase.vue similarity index 86% rename from src/views/evaluate/testData.vue rename to src/views/evaluate/testCase.vue index 8d2ab06e62739093332dfd0b223aa653a14f3b54..8c8f7bafdb0516b9dc3c1a93f6d430aa2926e28b 100644 --- a/src/views/evaluate/testData.vue +++ b/src/views/evaluate/testCase.vue @@ -3,7 +3,7 @@ :destroy-on-close="false"> @@ -23,20 +23,21 @@
- - - + + + - - - - - - - - - - + + + + + + + + + + + { if (resizeTimer) { @@ -221,7 +251,7 @@ const initChart = async () => { }, data: [ { - value: 82.5, + value: props.rowData?.score, } ] } @@ -280,7 +310,7 @@ const initChart = async () => { series: [ { type: 'bar', - data: [76, 70, 78, 80, 74, 82, 77], + data: Object.values(testCaseAvg.value), barWidth: '10%', itemStyle: { color: 'rgb(0,98,220)', @@ -343,6 +373,17 @@ onBeforeUnmount(() => { const handleClose = () => { props.close?.(); } + +const handleDownloadReport = () => { + const url = `${window.origin}/witchaind/api/testing/download?testingId=${props.rowData?.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); +} diff --git a/vite.config.ts b/vite.config.ts index 1f250add0392af0f44be60c3378731644a26a77e..6946977a22940fe735cb2fe6f88241a6dec299e2 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -54,11 +54,13 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => { open: true, proxy: { '/witchaind/api': { - target: 'https://euler-copilot-master.test.osinfra.cn/witchaind', + target: 'http://60.204.250.91:3002', + // target: 'https://qa-robot-openeuler.test.osinfra.cn/witchaind/', changeOrigin: true, ws: false, secure: false, - rewrite: (path) => path.replace(/^\/witchaind\/api/, '/api'), + rewrite: (path) => path.replace(/^\/witchaind\/api/, ''), + // rewrite: (path) => path.replace(/^\/witchaind\/api/, '/api'), }, }, }, @@ -208,17 +210,7 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => { // 构建配置 build: { chunkSizeWarningLimit: 2000, // 消除打包大小超过500kb警告 - minify: 'terser', // Vite 2.6.x 以上需要配置 minify: "terser", terserOptions 才能生效 - terserOptions: { - compress: { - keep_infinity: true, // 防止 Infinity 被压缩成 1/0,这可能会导致 Chrome 上的性能问题 - drop_console: true, // 生产环境去除 console - drop_debugger: true, // 生产环境去除 debugger - }, - format: { - comments: false, // 删除注释 - }, - }, + minify: 'esbuild', rollupOptions: { output: { // 用于从入口点创建的块的打包输出格式[name]表示文件名,[hash]表示该文件内容hash值