fix(frontend): Fix Login Direct Page
This commit is contained in:
@@ -176,12 +176,12 @@ deps:
|
|||||||
|
|
||||||
# Build for production
|
# Build for production
|
||||||
build-prod:
|
build-prod:
|
||||||
@VERSION=$${VERSION:-unknown}; \
|
VERSION=$${VERSION:-unknown}; \
|
||||||
COMMIT_ID=$${COMMIT_ID:-unknown}; \
|
COMMIT_ID=$${COMMIT_ID:-unknown}; \
|
||||||
BUILD_TIME=$${BUILD_TIME:-unknown}; \
|
BUILD_TIME=$${BUILD_TIME:-unknown}; \
|
||||||
GO_VERSION=$${GO_VERSION:-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'"; \
|
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:
|
clean-db:
|
||||||
@echo "Cleaning database..."
|
@echo "Cleaning database..."
|
||||||
|
|||||||
@@ -78,12 +78,30 @@
|
|||||||
<!-- 下半部分:账户信息、系统设置、退出登录 -->
|
<!-- 下半部分:账户信息、系统设置、退出登录 -->
|
||||||
<div class="menu_bottom">
|
<div class="menu_bottom">
|
||||||
<div class="menu_box" v-for="(item, index) in bottomMenuItems" :key="'bottom-' + index">
|
<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)"
|
@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' : '']">
|
: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_item-box">
|
||||||
<div class="menu_icon">
|
<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>
|
</div>
|
||||||
<span class="menu_title">{{ item.path === 'knowledge-bases' && kbMenuItem ? kbMenuItem.title : item.title }}</span>
|
<span class="menu_title">{{ item.path === 'knowledge-bases' && kbMenuItem ? kbMenuItem.title : item.title }}</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -444,9 +462,14 @@ const handleMenuClick = async (path: string) => {
|
|||||||
} else {
|
} else {
|
||||||
router.push('/platform/knowledge-bases')
|
router.push('/platform/knowledge-bases')
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
gotopage(path)
|
gotopage(path)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理退出登录确认
|
||||||
|
const handleLogout = () => {
|
||||||
|
gotopage('logout')
|
||||||
}
|
}
|
||||||
|
|
||||||
const getCurrentKbId = async (): Promise<string | null> => {
|
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>
|
</style>
|
||||||
@@ -25,7 +25,7 @@ const router = createRouter({
|
|||||||
{
|
{
|
||||||
path: "/platform",
|
path: "/platform",
|
||||||
name: "Platform",
|
name: "Platform",
|
||||||
redirect: "/platform/knowledgeBase",
|
redirect: "/platform/knowledge-bases",
|
||||||
component: () => import("../views/platform/index.vue"),
|
component: () => import("../views/platform/index.vue"),
|
||||||
meta: { requiresInit: true, requiresAuth: true },
|
meta: { requiresInit: true, requiresAuth: true },
|
||||||
children: [
|
children: [
|
||||||
@@ -79,7 +79,7 @@ router.beforeEach(async (to, from, next) => {
|
|||||||
if (to.meta.requiresAuth === false || to.meta.requiresInit === false) {
|
if (to.meta.requiresAuth === false || to.meta.requiresInit === false) {
|
||||||
// 如果已登录用户访问登录页面,重定向到知识库列表页面
|
// 如果已登录用户访问登录页面,重定向到知识库列表页面
|
||||||
if (to.path === '/login' && authStore.isLoggedIn) {
|
if (to.path === '/login' && authStore.isLoggedIn) {
|
||||||
next('/platform/knowledgeBase')
|
next('/platform/knowledge-bases')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
next()
|
next()
|
||||||
|
|||||||
@@ -274,7 +274,7 @@ const handleLogin = async () => {
|
|||||||
|
|
||||||
// 等待状态更新完成后再跳转
|
// 等待状态更新完成后再跳转
|
||||||
await nextTick()
|
await nextTick()
|
||||||
router.replace('/platform/knowledgeBase')
|
router.replace('/platform/knowledge-bases')
|
||||||
} else {
|
} else {
|
||||||
MessagePlugin.error(response.message || '登录失败,请检查邮箱或密码')
|
MessagePlugin.error(response.message || '登录失败,请检查邮箱或密码')
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1246,7 +1246,11 @@ const loadCurrentConfig = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 根据是否为知识库设置模式选择不同的API
|
// 根据是否为知识库设置模式选择不同的API
|
||||||
const config = await getCurrentConfigByKB(currentKbId.value);
|
if (props.isKbSettings && !currentKbId.value) {
|
||||||
|
console.error('知识库设置模式下缺少知识库ID');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const config = await getCurrentConfigByKB(currentKbId.value!);
|
||||||
|
|
||||||
// 设置hasFiles状态
|
// 设置hasFiles状态
|
||||||
hasFiles.value = config.hasFiles || false;
|
hasFiles.value = config.hasFiles || false;
|
||||||
@@ -1643,6 +1647,16 @@ onUnmounted(() => {
|
|||||||
watch(() => formData.llm.source, () => onModelSourceChange('llm'));
|
watch(() => formData.llm.source, () => onModelSourceChange('llm'));
|
||||||
watch(() => formData.embedding.source, () => onModelSourceChange('embedding'));
|
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 = () => {
|
const onRerankChange = () => {
|
||||||
console.log('Rerank enabled:', formData.rerank.enabled);
|
console.log('Rerank enabled:', formData.rerank.enabled);
|
||||||
@@ -1963,7 +1977,12 @@ const handleSubmit = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 根据是否为知识库设置模式选择不同的API
|
// 根据是否为知识库设置模式选择不同的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) {
|
if (result.success) {
|
||||||
MessagePlugin.success(props.isKbSettings ? '知识库设置更新成功' : (isUpdateMode.value ? '配置更新成功' : '系统初始化完成'));
|
MessagePlugin.success(props.isKbSettings ? '知识库设置更新成功' : (isUpdateMode.value ? '配置更新成功' : '系统初始化完成'));
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ const drop = (event) => {
|
|||||||
if (fileEntry) {
|
if (fileEntry) {
|
||||||
fileEntry.file((file: file) => {
|
fileEntry.file((file: file) => {
|
||||||
requestMethod(file, uploadInput)
|
requestMethod(file, uploadInput)
|
||||||
router.push('/platform/knowledgeBase?upload=true')
|
router.push('/platform/knowledge-bases?upload=true')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user