diff --git a/backend/apps/system/api/assistant.py b/backend/apps/system/api/assistant.py index a440cc57..69c90746 100644 --- a/backend/apps/system/api/assistant.py +++ b/backend/apps/system/api/assistant.py @@ -125,8 +125,15 @@ async def ui(session: SessionDep, data: str = Form(), files: List[UploadFile] = file_name, flag_name = SQLBotFileUtils.split_filename_and_flag(origin_file_name) file.filename = file_name if flag_name == 'logo' or flag_name == 'float_icon': - SQLBotFileUtils.check_file(file=file, file_types=[".jpg", ".jpeg", ".png", ".svg"], - limit_file_size=(10 * 1024 * 1024)) + try: + SQLBotFileUtils.check_file(file=file, file_types=[".jpg", ".png", ".svg"], + limit_file_size=(10 * 1024 * 1024)) + except ValueError as e: + error_msg = str(e) + if '文件大小超过限制' in error_msg: + raise ValueError(f"文件大小超过限制(最大 10 M)") + else: + raise e if config_obj.get(flag_name): SQLBotFileUtils.delete_file(config_obj.get(flag_name)) file_id = await SQLBotFileUtils.upload(file) diff --git a/frontend/src/i18n/en.json b/frontend/src/i18n/en.json index ef52ad18..e391aaca 100644 --- a/frontend/src/i18n/en.json +++ b/frontend/src/i18n/en.json @@ -465,6 +465,7 @@ "import": "Import", "change_file": "Change file", "data_import_completed": "Data import completed", + "notes_import_completed": "Import of notes complete", "imported_100_data": "Successfully imported {msg} data", "return_to_view": "Return to view", "continue_importing": "Continue importing", diff --git a/frontend/src/i18n/ko-KR.json b/frontend/src/i18n/ko-KR.json index 73e05fe0..67761460 100644 --- a/frontend/src/i18n/ko-KR.json +++ b/frontend/src/i18n/ko-KR.json @@ -465,6 +465,7 @@ "import": "가져오기", "change_file": "파일 변경", "data_import_completed": "데이터 가져오기 완료", + "notes_import_completed": "메모 가져오기 완료", "imported_100_data": "데이터 {msg}개를 성공적으로 가져왔습니다", "return_to_view": "돌아가서 보기", "continue_importing": "계속 가져오기", @@ -850,4 +851,4 @@ "to_doc": "API 보기", "trigger_limit": "최대 {0}개의 API 키 생성 지원" } -} +} \ No newline at end of file diff --git a/frontend/src/i18n/zh-CN.json b/frontend/src/i18n/zh-CN.json index 79e36caf..1f652bf1 100644 --- a/frontend/src/i18n/zh-CN.json +++ b/frontend/src/i18n/zh-CN.json @@ -466,6 +466,7 @@ "import": "导入", "change_file": "更换文件", "data_import_completed": "数据导入完成", + "notes_import_completed": "备注导入完成", "imported_100_data": "成功导入数据 {msg} 条", "return_to_view": "返回查看", "continue_importing": "继续导入", diff --git a/frontend/src/router/watch.ts b/frontend/src/router/watch.ts index ff5276f0..c1aaf8fe 100644 --- a/frontend/src/router/watch.ts +++ b/frontend/src/router/watch.ts @@ -34,9 +34,15 @@ export const watchRouter = (router: Router) => { next('/login') return } + let isFirstDynamicPath = false if (!userStore.getUid) { await userStore.info() generateDynamicRouters(router) + isFirstDynamicPath = to?.path === '/ds/index' + if (isFirstDynamicPath) { + next({ ...to, replace: true }) + return + } } if (to.path === '/' || accessCrossPermission(to)) { next('/chat') diff --git a/frontend/src/views/chat/RecommendQuestionQuick.vue b/frontend/src/views/chat/RecommendQuestionQuick.vue index 4a31fdd5..d2fe67f3 100644 --- a/frontend/src/views/chat/RecommendQuestionQuick.vue +++ b/frontend/src/views/chat/RecommendQuestionQuick.vue @@ -53,7 +53,7 @@ async function getRecommendQuestions(articles_number: number) { if (res.recommended_config === 2) { questions.value = res.questions } else if (currentChat.value.recommended_generate) { - questions.value = currentChat.value.recommended_question + questions.value = currentChat.value.recommended_question as string } else { getRecommendQuestionsLLM(articles_number) } diff --git a/frontend/src/views/ds/DataTable.vue b/frontend/src/views/ds/DataTable.vue index d0db7d2b..70c7b29a 100644 --- a/frontend/src/views/ds/DataTable.vue +++ b/frontend/src/views/ds/DataTable.vue @@ -107,9 +107,13 @@ const handleCurrentChange = (val: number) => { const fieldListComputed = computed(() => { const { currentPage, pageSize } = pageInfo - return fieldList.value - .filter((ele: any) => ele.field_name.toLowerCase().includes(fieldName.value.toLowerCase())) - .slice((currentPage - 1) * pageSize, currentPage * pageSize) + return fieldListTotalComputed.value.slice((currentPage - 1) * pageSize, currentPage * pageSize) +}) + +const fieldListTotalComputed = computed(() => { + return fieldList.value.filter((ele: any) => + ele.field_name.toLowerCase().includes(fieldName.value.toLowerCase()) + ) }) const init = (reset = false) => { @@ -319,7 +323,7 @@ const renderHeader = ({ column }: any) => { } const fieldNameSearch = debounce(() => { pageInfo.currentPage = 1 - pageInfo.total = fieldListComputed.value.length + pageInfo.total = fieldListTotalComputed.value.length }, 100) const fieldName = ref('') const btnSelectClick = (val: any) => { diff --git a/frontend/src/views/ds/DatasourceForm.vue b/frontend/src/views/ds/DatasourceForm.vue index 3c23128b..b8d99933 100644 --- a/frontend/src/views/ds/DatasourceForm.vue +++ b/frontend/src/views/ds/DatasourceForm.vue @@ -424,7 +424,8 @@ const onSuccess = (response: any) => { uploadLoading.value = false } -const onError = () => { +const onError = (e: any) => { + ElMessage.error(e.toString()) uploadLoading.value = false } diff --git a/frontend/src/views/login/index.vue b/frontend/src/views/login/index.vue index d40c0e45..85ee42e6 100644 --- a/frontend/src/views/login/index.vue +++ b/frontend/src/views/login/index.vue @@ -24,7 +24,7 @@ }}
- {{ appearanceStore.slogan || $t('common.intelligent_questioning_platform') }} + {{ appearanceStore.slogan ?? $t('common.intelligent_questioning_platform') }}
diff --git a/frontend/src/views/login/xpack/Handler.vue b/frontend/src/views/login/xpack/Handler.vue index e564583c..d5fb2a1a 100644 --- a/frontend/src/views/login/xpack/Handler.vue +++ b/frontend/src/views/login/xpack/Handler.vue @@ -556,8 +556,8 @@ const auto2Platform = async () => { resObj[item.pkey] = item.pval }) res = parseInt(resObj['login.default_login'] || 0) - - if (res && !adminLogin.value) { + const originArray = ['default', 'cas', 'oidc', 'ldap', 'oauth2', 'saml2'] + if (res && !adminLogin.value && loginCategory.value[originArray[res] as keyof LoginCategory]) { if (res === 3) { qrStatusChange('ldap') updateLoading(false) diff --git a/frontend/src/views/system/appearance/LoginPreview.vue b/frontend/src/views/system/appearance/LoginPreview.vue index 7e2ba2d7..17ecb744 100644 --- a/frontend/src/views/system/appearance/LoginPreview.vue +++ b/frontend/src/views/system/appearance/LoginPreview.vue @@ -52,7 +52,7 @@
- {{ pageSlogan || t('system.available_to_everyone') }} + {{ pageSlogan ?? t('common.intelligent_questioning_platform') }}
diff --git a/frontend/src/views/system/embedded/SetUi.vue b/frontend/src/views/system/embedded/SetUi.vue index 3b6005ed..e0a0cbe6 100644 --- a/frontend/src/views/system/embedded/SetUi.vue +++ b/frontend/src/views/system/embedded/SetUi.vue @@ -156,12 +156,12 @@ const customColorChange = (val: any) => { } const setPageCustomColor = (val: any) => { - const ele = document.querySelector('.ui-main') as HTMLElement + const ele = document.querySelector('.left-preview') as HTMLElement setCurrentColor(val, ele) } const setPageHeaderFontColor = (val: any) => { - const ele = document.getElementsByClassName('ui-main')[0] as HTMLElement + const ele = document.getElementsByClassName('left-preview')[0] as HTMLElement ele.style.setProperty('--ed-text-color-primary', val) } const resetSqlBotForm = (reset2Default?: boolean) => { diff --git a/frontend/src/views/system/excel-upload/UploaderRemark.vue b/frontend/src/views/system/excel-upload/UploaderRemark.vue index ee01da76..ed827c91 100644 --- a/frontend/src/views/system/excel-upload/UploaderRemark.vue +++ b/frontend/src/views/system/excel-upload/UploaderRemark.vue @@ -134,7 +134,7 @@ const onError = (err: Error) => { infoMessage.value = msg hasError.value = true close() - showResult() + ElMessage.error(err.toString()) } const dialogShow = ref(false) @@ -144,7 +144,13 @@ const resultShow = ref(false) function showResult() { resultShow.value = true } - +function closeResult() { + resultShow.value = false +} +function backToUpload() { + closeResult() + open() +} function open() { dialogShow.value = true errorFileName.value = '' @@ -253,6 +259,27 @@ const submitUpload = () => { + + +
+ {{ infoMessage }} +
+ + +