Merge remote-tracking branch 'origin/main'

This commit is contained in:
wangjiahao
2025-12-30 11:33:43 +08:00
13 changed files with 65 additions and 17 deletions
+9 -2
View File
@@ -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)
+1
View File
@@ -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",
+2 -1
View File
@@ -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 키 생성 지원"
}
}
}
+1
View File
@@ -466,6 +466,7 @@
"import": "导入",
"change_file": "更换文件",
"data_import_completed": "数据导入完成",
"notes_import_completed": "备注导入完成",
"imported_100_data": "成功导入数据 {msg} 条",
"return_to_view": "返回查看",
"continue_importing": "继续导入",
+6
View File
@@ -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')
@@ -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)
}
+8 -4
View File
@@ -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) => {
+2 -1
View File
@@ -424,7 +424,8 @@ const onSuccess = (response: any) => {
uploadLoading.value = false
}
const onError = () => {
const onError = (e: any) => {
ElMessage.error(e.toString())
uploadLoading.value = false
}
+1 -1
View File
@@ -24,7 +24,7 @@
}}</span>
</div>
<div v-if="appearanceStore.getShowSlogan" class="welcome">
{{ appearanceStore.slogan || $t('common.intelligent_questioning_platform') }}
{{ appearanceStore.slogan ?? $t('common.intelligent_questioning_platform') }}
</div>
<div v-else class="welcome" style="height: 0"></div>
<div class="login-form">
+2 -2
View File
@@ -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)
@@ -52,7 +52,7 @@
</div>
</div>
<div v-if="isBtnShow(showSlogan)" class="login-welcome">
{{ pageSlogan || t('system.available_to_everyone') }}
{{ pageSlogan ?? t('common.intelligent_questioning_platform') }}
</div>
<div v-else class="login-welcome"></div>
</div>
+2 -2
View File
@@ -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) => {
@@ -134,7 +134,7 @@ const onError = (err: Error) => {
infoMessage.value = msg
hasError.value = true
close()
showResult()
ElMessage.error(err.toString())
}
const dialogShow = ref<boolean>(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 = () => {
</span>
</template>
</el-dialog>
<el-dialog
v-model="resultShow"
:title="t('user.notes_import_completed')"
width="600px"
class="user-import-class"
@close="closeResult"
>
<div class="down-template-content">
{{ infoMessage }}
</div>
<template #footer>
<span class="dialog-footer">
<el-button @click="closeResult">{{ t('common.cancel') }}</el-button>
<el-button type="primary" @click="backToUpload">
{{ t('common.continue_to_upload') }}
</el-button>
</span>
</template>
</el-dialog>
</template>
<style lang="less">