Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.
Go agentagenticaichatbotdsh-pluginembeddingsevaluationgenerative-aigolangknowledge-basellmmulti-tenantollamaopenaiquestion-answeringragrerankingsemantic-searchvector-searchwiki
fix(frontend): Fix Login Direct Page
wizardchen41ea7b64a696
diff --git a/Makefile b/Makefileindex dde85f429..41c3ad836 100644--- a/Makefile+++ b/Makefile@@ -176,12 +176,12 @@ deps:# Build for productionbuild-prod:- @VERSION=$${VERSION:-unknown}; \+ VERSION=$${VERSION:-unknown}; \COMMIT_ID=$${COMMIT_ID:-unknown}; \BUILD_TIME=$${BUILD_TIME:-unknown}; \GO_VERSION=$${GO_VERSION:-unknown}; \LDFLAGS="-X 'github.com/Tencent/WeKnora/internal/handler.Version=$$VERSION' -X 'github.com/Tencent/WeKnora/internal/handler.CommitID=$$COMMIT_ID' -X 'github.com/Tencent/WeKnora/internal/handler.BuildTime=$$BUILD_TIME' -X 'github.com/Tencent/WeKnora/internal/handler.GoVersion=$$GO_VERSION'"; \- GOOS=linux go build -installsuffix cgo -ldflags="-w -s $$LDFLAGS" -o $(BINARY_NAME) $(MAIN_PATH)+ GOOS=linux go build -v -installsuffix cgo -ldflags="-w -s $$LDFLAGS" -o $(BINARY_NAME) $(MAIN_PATH)clean-db:@echo "Cleaning database..."diff --git a/frontend/src/components/menu.vue b/frontend/src/components/menu.vueindex d5ca73bc7..efd7f7303 100644--- a/frontend/src/components/menu.vue+++ b/frontend/src/components/menu.vue@@ -78,12 +78,30 @@<!-- 下半部分:账户信息、系统设置、退出登录 --><div class="menu_bottom"><div class="menu_box" v-for="(item, index) in bottomMenuItems" :key="'bottom-' + index">- <div @click="handleMenuClick(item.path)"+ <div v-if="item.path === 'logout'">+ <t-popconfirm+ content="确定要退出登录吗?"+ @confirm="handleLogout"+ placement="top"+ :show-arrow="true"+ >+ <div @mouseenter="mouseenteMenu(item.path)" @mouseleave="mouseleaveMenu(item.path)"+ :class="['menu_item', 'logout-item']">+ <div class="menu_item-box">+ <div class="menu_icon">+ <img class="icon" :src="getImgSrc(logoutIcon)" alt="">+ </div>+ <span class="menu_title">{{ item.title }}</span>+ </div>+ </div>+ </t-popconfirm>+ </div>+ <div v-else @click="handleMenuClick(item.path)"@mouseenter="mouseenteMenu(item.path)" @mouseleave="mouseleaveMenu(item.path)":class="['menu_item', item.childrenPath && item.childrenPath == currentpath ? 'menu_item_c_active' : (item.path == currentpath) ? 'menu_item_active' : '']"><div class="menu_item-box"><div class="menu_icon">- <img class="icon" :src="getImgSrc(item.icon == 'zhishiku' ? knowledgeIcon : item.icon == 'logout' ? logoutIcon : item.icon == 'tenant' ? tenantIcon : prefixIcon)" alt="">+ <img class="icon" :src="getImgSrc(item.icon == 'zhishiku' ? knowledgeIcon : item.icon == 'tenant' ? tenantIcon : prefixIcon)" alt=""></div><span class="menu_title">{{ item.path === 'knowledge-bases' && kbMenuItem ? kbMenuItem.title : item.title }}</span></div>@@ -444,9 +462,14 @@ const handleMenuClick = async (path: string) => {} else {router.push('/platform/knowledge-bases')}- } else {- gotopage(path)- }+ } else {+ gotopage(path)+ }+}++// 处理退出登录确认+const handleLogout = () => {+ gotopage('logout')}const getCurrentKbId = async (): Promise<string | null> => {@@ -914,4 +937,48 @@ watch(() => route.params.kbId, () => {}}++// 退出登录确认框样式+:deep(.t-popconfirm) {+ .t-popconfirm__content {+ background: #fff;+ border: 1px solid #e7e7e7;+ border-radius: 6px;+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);+ padding: 12px 16px;+ font-size: 14px;+ color: #333;+ max-width: 200px;+ }++ .t-popconfirm__arrow {+ border-bottom-color: #e7e7e7;+ }++ .t-popconfirm__arrow::after {+ border-bottom-color: #fff;+ }++ .t-popconfirm__buttons {+ margin-top: 8px;+ display: flex;+ justify-content: flex-end;+ gap: 8px;+ }++ .t-button--variant-outline {+ border-color: #d9d9d9;+ color: #666;+ }++ .t-button--theme-danger {+ background-color: #ff4d4f;+ border-color: #ff4d4f;+ }++ .t-button--theme-danger:hover {+ background-color: #ff7875;+ border-color: #ff7875;+ }+}</style>\ No newline at end of filediff --git a/frontend/src/router/index.ts b/frontend/src/router/index.tsindex adb0f9904..8432b0a87 100644--- a/frontend/src/router/index.ts+++ b/frontend/src/router/index.ts@@ -25,7 +25,7 @@ const router = createRouter({{path: "/platform",name: "Platform",- redirect: "/platform/knowledgeBase",+ redirect: "/platform/knowledge-bases",component: () => import("../views/platform/index.vue"),meta: { requiresInit: true, requiresAuth: true },children: [@@ -79,7 +79,7 @@ router.beforeEach(async (to, from, next) => {if (to.meta.requiresAuth === false || to.meta.requiresInit === false) {// 如果已登录用户访问登录页面,重定向到知识库列表页面if (to.path === '/login' && authStore.isLoggedIn) {- next('/platform/knowledgeBase')+ next('/platform/knowledge-bases')return}next()diff --git a/frontend/src/views/auth/Login.vue b/frontend/src/views/auth/Login.vueindex 0fab857ad..efd2e9269 100644--- a/frontend/src/views/auth/Login.vue+++ b/frontend/src/views/auth/Login.vue@@ -274,7 +274,7 @@ const handleLogin = async () => {// 等待状态更新完成后再跳转await nextTick()- router.replace('/platform/knowledgeBase')+ router.replace('/platform/knowledge-bases')} else {MessagePlugin.error(response.message || '登录失败,请检查邮箱或密码')}diff --git a/frontend/src/views/initialization/InitializationContent.vue b/frontend/src/views/initialization/InitializationContent.vueindex 6e909d21a..9bd10e4e7 100644--- a/frontend/src/views/initialization/InitializationContent.vue+++ b/frontend/src/views/initialization/InitializationContent.vue@@ -1246,7 +1246,11 @@ const loadCurrentConfig = async () => {}// 根据是否为知识库设置模式选择不同的API- const config = await getCurrentConfigByKB(currentKbId.value);+ if (props.isKbSettings && !currentKbId.value) {+ console.error('知识库设置模式下缺少知识库ID');+ return;+ }+ const config = await getCurrentConfigByKB(currentKbId.value!);// 设置hasFiles状态hasFiles.value = config.hasFiles || false;@@ -1643,6 +1647,16 @@ onUnmounted(() => {watch(() => formData.llm.source, () => onModelSourceChange('llm'));watch(() => formData.embedding.source, () => onModelSourceChange('embedding'));+// 监听路由参数变化,当知识库ID变化时重新加载配置+watch(() => route.params.kbId, async (newKbId, oldKbId) => {+ // 只有在知识库设置模式下且ID确实发生变化时才重新加载+ if (props.isKbSettings && newKbId && newKbId !== oldKbId) {+ console.log('知识库ID变化,重新加载配置:', { oldKbId, newKbId });+ await loadCurrentConfig();+ await checkAllConfiguredModels();+ }+}, { immediate: false });+// 添加缺失的函数const onRerankChange = () => {console.log('Rerank enabled:', formData.rerank.enabled);@@ -1963,7 +1977,12 @@ const handleSubmit = async () => {}// 根据是否为知识库设置模式选择不同的API- const result = await initializeSystemByKB(currentKbId.value, formData);+ if (props.isKbSettings && !currentKbId.value) {+ console.error('知识库设置模式下缺少知识库ID');+ MessagePlugin.error('知识库ID缺失,无法保存配置');+ return;+ }+ const result = await initializeSystemByKB(currentKbId.value!, formData);if (result.success) {MessagePlugin.success(props.isKbSettings ? '知识库设置更新成功' : (isUpdateMode.value ? '配置更新成功' : '系统初始化完成'));diff --git a/frontend/src/views/platform/index.vue b/frontend/src/views/platform/index.vueindex aa7b06ed4..bcd0810c0 100644--- a/frontend/src/views/platform/index.vue+++ b/frontend/src/views/platform/index.vue@@ -38,7 +38,7 @@ const drop = (event) => {if (fileEntry) {fileEntry.file((file: file) => {requestMethod(file, uploadInput)- router.push('/platform/knowledgeBase?upload=true')+ router.push('/platform/knowledge-bases?upload=true')})}}